Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - MultiformeIngegno
511
Features / Re:
« on April 19th, 2012, 07:37 PM »
Quote from Nao on April 19th, 2012, 06:15 PM
(I'm on iOS 4.x BTW -- maybe it's all magically fixed in 5.0...?)
Textarea works for me on iOS 5. :)

Select code link does nothing.. :(
512
Off-topic / Re: Extract images with a certain tag from Instagram
« on April 19th, 2012, 06:14 PM »
Added the cache:
Code: [Select]
function get_instagram($user_id=3,$count=3,$width=70,$height=70){

    $url = 'https://api.instagram.com/v1/users/'.$user_id.'/media/recent/?access_token=13137.f59def8.1a759775695548999504c219ce7b2ecf&count='.$count;

    //Also Perhaps you should cache the results as the instagram API is slow
    $cache = './'.sha1($url).'.json';
    if(file_exists($cache) && filemtime($cache) > time() - 60*60){
        // If a cache file exists, and it is newer than 1 hour, use it
        $jsonData = json_decode(file_get_contents($cache));
    }else{
        $jsonData = json_decode((file_get_contents($url)));
        file_put_contents($cache,json_encode($jsonData));
    }

    $result = '<ul>'.PHP_EOL;
    foreach ($jsonData->data as $key=>$value) {
        $result .= "\t".'<li><a href="'.$value->link.'"><img src="'.$value->images->standard_resolution->url.'" alt="" width="'.$width.'" height="'.$height.'" /></a></li>'.PHP_EOL;
    }
    $result .= '</ul>'.PHP_EOL;
    return $result;
}

echo get_instagram();
513
Off-topic / Re: Extract images with a certain tag from Instagram
« on April 19th, 2012, 06:00 PM »
Yayyyy!! This works!!!! ;) ;)

Code: [Select]
function get_instagram($user_id=3,$count=3,$width=70,$height=70){

    $url = 'https://api.instagram.com/v1/users/'.$user_id.'/media/recent/?access_token=13137.f59def8.1a759775695548999504c219ce7b2ecf&count='.$count;
    $jsonData = json_decode((file_get_contents($url)));
    $result = '<ul>'.PHP_EOL;
    foreach ($jsonData->data as $key=>$value) {
        $result .= "\t".'<li><a href="'.$value->link.'"><img src="'.$value->images->standard_resolution->url.'" width="'.$width.'" height="'.$height.'" /></a></li>'.PHP_EOL;
    }
    $result .= '</ul>'.PHP_EOL;
    return $result;
}

echo get_instagram();

514
Features / "Select" code on iPhone
« on April 19th, 2012, 04:48 PM »
Would be useful to have the "select" code link working on Safari Mobile too! :)
515
Off-topic / Re: Extract images with a certain tag from Instagram
« on April 19th, 2012, 04:40 PM »
This should be better, no?
Code: [Select]
<?php
function get_instagram($user_id,$count)
{
$user_id '3';
$count '3';
$url 'https://api.instagram.com/v1/users/'.$user_id.'/media/recent/?access_token=13137.f59def8.1a759775695548999504c219ce7b2ecf&count='.$count;
$jsonData $json_decode((file_get_contents($url)));
$data $jsonData->data;
$result '<ul>';
foreach ($data as $key => $value) {
$result .= '<li><a href='.$value->link.' ><img src="'.$value->images->standard_resolution->url.'" width="70" height="70" /></a></li> ';
}
$result .= '</ul>';
echo $result;
}

Result is blank page though... :blush:
516
Off-topic / Re: Extract images with a certain tag from Instagram
« on April 19th, 2012, 03:18 AM »
I studied JSON a bit and managed to create a "twitter widget" (okay I copied the part for($i=0;$i<$count;$i++), the rest is mine tough :P):
Code: [Select]
<?php
$json file_get_contents("http://twitter.com/status/user_timeline/lorenzoraffio.json?count=10"true);
$decode json_decode($jsontrue);
echo "
<ul style='color:#6E6E6E'>"
;
$count count($decode); //counting the number of status
$date $tweets['created_at']; // created date
for($i=0;$i<$count;$i++){ echo '
<li>'
.$decode[$i]['text'].'<br><a href='; echo '"http://twitter.com/#!/'.$decode[0][user][name].'/status/'.$decode[$i][id].'"><small>'date('j F',strtotime($decode[$i]['created_at'])) ."</small></a> - <a href='http://twitter.com/intent/tweet?in_reply_to=".$decode[$i][id]."'><small>rispondi</small></a> - <a href='http://twitter.com/intent/retweet?tweet_id=".$decode[$i][id]."'><small>retweet</small></a> - <a href='http://twitter.com/intent/favorite?tweet_id=".$decode[$i][id]."'><small>preferito</small></a></li>";} echo "
</ul>
"
;
?>


And this works!! ;)

The problem is that I tried to do the same for Instagram (replacing the parameters) but seems more complicated...!
517
Off-topic / Re: Extract images with a certain tag from Instagram
« on April 19th, 2012, 12:55 AM »
Uhm.. look at this other piece of code:
Code: [Select]
<?php
$instagramClientID 
'9110e8c268384cb79901a96e3a16f588';
$api 'https://api.instagram.com/v1/tags/snow/media/recent?client_id='.$instagramClientID//api request (edit this to reflect tags)
$response file_get_contents($api,0,null,null);

$instagrams json_decode($response)->data;

$features = array();
foreach ( 
$instagrams as $instagram ) {
    
$features[] = array(
        
'properties' => array(
            
'image' => $instagram->images->standard_resolution->url,
            
'description' => $instagram->caption $instagram->caption->text null,
        )
    );
}

$results = array(
    
'features' => $features,
);

print_r($results);

?>


Instead of print_r($results); I'd like to have the ability to output something like:
<img src="<?php $image ?>" alt="<?php $description ?>" />

The problem is how can I specify which parameter of which entry needs to be shown..?
The result should be something like <img src="IMAGE 1" alt="DESCRIPTION1" /><img src="IMAGE 2" alt="DESCRIPTION2" /><img src="IMAGE 3" alt="DESCRIPTION3" />
518
Off-topic / Re: Extract images with a certain tag from Instagram
« on April 18th, 2012, 10:51 PM »
Quote from Arantor on April 18th, 2012, 10:14 PM
The code is not acting as it should. What it is doing that is different to what you want?
Well, this is the code (simplifed):
Code: [Select]
<?php 
$json 
file_get_contents('https://api.instagram.com/v1/tags/snow/media/recent?client_id=XXX'); 
$decode json_decode($jsontrue); 
var_dump($decode); 
?>

<?php 
    
foreach ($decode['data'] as $data) { 
        
$thumbnail $data['images']['low_resolution']['url']; 
}
    
?>

    <div>
        <img src="<?php $thumbnail ?>" alt="" />
</div>

It outputs ALL the JSON file (because of the file_get_contents). I want just the $thumbnail variable for each entry. :)
There's something wrong with the foreach(). At the end of the file I get: Warning: Invalid argument supplied for foreach()
519
Off-topic / Re: Extract images with a certain tag from Instagram
« on April 18th, 2012, 10:06 PM »
Quote from Arantor on April 18th, 2012, 09:51 PM
Showing me a bunch of code, showing me another bunch of code, I have no idea what you're supposed to be getting, but hey, I'm sure we'll figure it out when you tell me these things...
Ok, let's try. :P
I want to extract data from the JSON file (the one in file_get_contents). It "outputs" new stuff every time that users post images with the "snow" tag (in this case), always with the same structure, for example:
{"username":"XXX","profile_picture":"XXX","id":"XXX","full_name":"XXX"},"id":"XXX"}]},,"images":{"low_resolution":{"url":"http:XXX","width":XXX,"height":XXX},"thumbnail":{"url":"http:XXX","width":XXX,"height":XXX:" etc...

I need to extract some of these information. For example I may want to extract and display username and low res URL only for every entry.

P.S.: Posts preview is broken.. :whistle:
520
Off-topic / Re: Post count fever
« on April 18th, 2012, 09:50 PM »
Amazing! :o
521
Off-topic / Re: Extract images with a certain tag from Instagram
« on April 18th, 2012, 09:48 PM »
This is a piece of the very long code I get if I visit the file_get_contents URL (after adding the Client ID/token):
Code: [Select]
{"pagination":{"next_max_tag_id":"1334803018782","deprecation_warning":"next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead","next_max_id":"1334803018782","next_min_id":"1334803397349","min_tag_id":"1334803397349","next_url":"https:\/\/api.instagram.com\/v1\/tags\/snow\/media\/recent?client_id=3d61d317425440a1aee6c9b795b0fe92&max_tag_id=1334803018782"},"meta":{"code":200},"data":[{"tags":["horses","centreparcs","snow","santa","winter"],"location":{"latitude":51.1865,"longitude":-2.2355},"comments":{"count":1,"data":[{"created_time":"1334778197","text":"#winter #centreparcs #horses #santa #snow","from":{"username":"mattpeno","profile_picture":"http:\/\/images.instagram.com\/profiles\/profile_22685403_75sq_1334421562.jpg","id":"22685403","full_name":"Matt Penistone"},"id":"172454476287201505"}]},"filter":"Lord Kelvin","created_time":"1334778119","link":"http:\/\/instagr.am\/p\/JkrdZ7BlKe\/","likes":{"count":0,"data":[]},"images":{"low_resolution":{"url":"http:\/\/distilleryimage6.instagram.com\/90185cf0898e11e1a87612313804ec91_6.jpg","width":306,"height":306},"thumbnail":{"url":"http:\/\/distilleryimage6.instagram.com\/90185cf0898e11e1a87612313804ec91_5.jpg","width":150,"height":150},"standard_resolution":{"url":"http:\/\/distilleryimage6.instagram.com\/90185cf0898e11e1a87612313804ec91_7.jpg","width":612,"height":612}},"caption":{"created_time":"1334778134","text":"Snow horse","from":{"username":"mattpeno","profile_picture":"http:\/\/images.instagram.com\/profiles\/profile_22685403_75sq_1334421562.jpg","id":"22685403","full_name":"Matt Penistone"},"id":"172453947268026590"},"type":"image","id":"172453822445539998_22685403","user":{"username":"mattpeno","website":"","bio":"\ud83d\udc7ffun loving\ud83d\udc9a\r\n\ud83d\ude32punk rocking\ud83d\udc7d\r\n\ud83d\udc38spaceship flying\ud83d\ude80\r\n\ud83d\ude1ccider drinking\ud83c\udf7a\r\n27 year old something..","profile_picture":"http:\/\/images.instagram.com\/profiles\/profile_22685403_75sq_1334421562.jpg","full_name":"Matt Penistone","id":"22685403"}},{"tags":["switzerland","snow","winter","forest"],"location":null,"comments":{"count":0,"data":[]},"filter":"Amaro","created_time":"1334775900","link":"http:\/\/instagr.am\/p\/JknOf2u8TC\/","likes":{"count":1,"data":[{"username":"martinboygaard","profile_picture":"http:\/\/images.instagram.com\/profiles\/profile_22343546_75sq_1333840303.jpg","id":"22343546","full_name":"Martin B\u00f8ygaard"}]},"images":{"low_resolution":{"url":"http:\/\/distilleryimage10.instagram.com\/654e02c2898911e1af7612313813f8e8_6.jpg","width":306,"height":306},"thumbnail":{"url":"http:\/\/distilleryimage10.instagram.com\/654e02c2898911e1af7612313813f8e8_5.jpg","width":150,"height":150},"standard_resolution":{"url":"http:\/\/distilleryimage10.instagram.com\/654e02c2898911e1af7612313813f8e8_7.jpg","width":612,"height":612}},"caption":{"created_time":"1334778184","text":"#forest #snow #winter #switzerland","from":{"username":"sharkypowaaa","profile_picture":"http:\/\/images.instagram.com\/profiles\/profile_37503824_75sq_1334745578.jpg","id":"37503824","full_name":"sharkypowaaa"},"id":"172454365510747828"},"type":"image","id":"172435205837800642_37503824","user":{"username":"sharkypowaaa","website":"","bio":"","profile_picture":"http:\/\/images.instagram.com\/profiles\/profile_37503824_75sq_1334745578.jpg","full_name":"sharkypowaaa","id":"37503824"}},{"tags":["snow"],"location":null,"comments":{"count":1,"data":[{"created_time":"1334778181","text":"#snow","from":{"username":"mosodal","profile_picture":"http:\/\/images.instagram.com\/profiles\/profile_32258055_75sq_1333988855.jpg","id":"32258055","full_name":"Monika"},"id":"172454342583894661"}]},"filter":"Valencia","created_time":"1334778146","link":"http:\/\/instagr.am\/p\/JkrgqML8BM\/","likes":{"count":0,"data":[]},"images":{"low_resolution":{"url":"http:\/\/distilleryimage0.instagram.com\/9ffbeb50898e11e19e4a12313813ffc0_6.jpg","width":306,"height":306},"thumbnail":{"url":"http:\/\/distilleryimage0.instagram.com\/9ffbeb50898e11e19e4a12313813ffc0_5.jpg","width":150,"height":150},"standard_resolution":{"url":"http:\/\/distilleryimage0.instagram.com\/9ffbeb50898e11e19e4a12313813ffc0_7.jpg","width":612,"height":612}},"caption":{"created_time":"1334778159","text":"Ja, jeg hadde s\u00e5 lyst p\u00e5 sn\u00f8 n\u00e5.","from":{"username":"mosodal","profile_picture":"http:\/\/images.instagram.com\/profiles\/profile_32258055_75sq_1333988855.jpg","id":"32258055","full_name":"Monika"},"id":"172454157078217347"},"type":"image","id":"172454046071767116_32258055","user":{"username":"mosodal","website":"","bio":"jente, 17 \u00e5r, NORGE :-) ","profile_picture":"http:\/\/images.instagram.com\/profiles\/profile_32258055_75sq_1333988855.jpg","full_name":"Monika","id":"32258055"}},{"tags":["bradford","igerseurope","igersportugal","snow","statigram"],"location":null,"comments":{"count":0,"data":[]},"filter":"Lord Kelvin","created_time":"1334778177","link":"http:\/\/instagr.am\/p\/JkrkgxvQZ8\/","likes":{"count":0,"data":[]},"images":{"low_resolution":{"url":"http:\/\/distilleryimage8.instagram.com\/b2cc04ea898e11e1989612313815112c_6.jpg","width":306,"height":306},"thumbnail":{"url":"http:\/\/distilleryimage8.instagram.com\/b2cc04ea898e11e1989612313815112c_5.jpg","width":150,"height":150},"standard_resolution":{"url":"http:\/\/distilleryimage8.instagram.com\/b2cc04ea898e11e1989612313815112c_7.jpg","width":612,"height":612}},"caption":{"created_time":"1334778178","text":"#igersportugal #snow #igerseurope #bradford #statigram","from":

I said it doesn't work because with the code I mentioned in the previous post I get this:
multiformeingegno.it/wp-content/themes/multiformeingegno/test.php
522
Off-topic / Extract images with a certain tag from Instagram
« on April 18th, 2012, 08:59 PM »
Hi guys! :)
I'm trying to display a number of recent photos from Instagram that have a certain tag (for example: "snow").

I have never done this before (and I have PHP and JSON knowledge equal to 0,1.. :P ) + saying that Instagram API's documentation is poor is a gift!!

Here's the code I'm trying..

Code: [Select]
<?php 
$json 
file_get_contents('https://api.instagram.com/v1/tags/snow/media/recent?client_id=XXX'); 
$decode json_decode($jsontrue); 
var_dump($decode); 
?>

<?php 
    
foreach ($response['data'] as $data) { 
        
$thumbnail $data['images']['low_resolution']['url']; 
        
$author $data['caption']['from']['username']; 
        
$date $data['created_time']; 
        
$text $data['caption']['text']; 
        
$link $data['link']; }
    
?>

    <div>
        <a href="<?php $link ?>"><span></span><img src="<?php $thumbnail ?>" title="<?php $text ?>" alt="<?php $text ?>" /></a>

        <div>via <?php $author ?> at <?php echo date("h:i:s A \o\\n d/m/Y",$date); ?></div>
        <?php $text ?>
</div>

Ehm.. (of course?) it doesn't work.. do you have an idea of what I need to change?

Thankssss ;)

EDIT: XXX is the client ID I have.
523
Plugins / Re: Light URL Plugin Maybe?
« on April 17th, 2012, 12:42 AM »
I can't really understand all this interest on URL shorteners.. You still won't remember something like g.co/hyT&tR SO WHY CHANGE THE URL??

1. There's no benefit in memorabilty
2. Your link relies on a 3rd party server (if they change their URLs structure OR their server goes down OR their company fails OR for whatever reason the link doesn't work there's nothing you can do
3. Loading is slower (also if it's the speedest server on earth the loading will be slower than the original link because of the redirection)..

In short: I can't find a reason for an external url shortner to exist. For internal... dunno.. I'm ok with PURLs.. :P
524
Archived fixes / Re: Buggy Feed links
« on April 14th, 2012, 06:34 PM »
Quote from Arantor on April 14th, 2012, 05:16 PM
I have thought about dropping it entirely and relying on only cookies to handle sessions but that will confuse the tracking of max users on systems that can't properly handle cookies (like some search engines, paranoid guests), but not sure yet.
This seems interesting! ;)
525
Bug reports / Re: Pretty URL remarks
« on April 14th, 2012, 03:16 PM »
The wizard is in action!!! 400% faster.. :o