I’ve a Wordpress site where I uses my Flickr feed to get my latest images. By using a script, I create a new post everytime I’ve a new image on Flickr but, the image thumbnail source is from Flickr and when I press the thumbnail I’m redirected to the Flickr image.
I want to close down my wordpress site for any new content and want to close it off from all third part APIs and Services, so I want to run through my list of Flickr posts and download every thumbnails and images I’m referring to.
An example of a Flickr post on my blog with an image looks like this:
<a href="http://www.flickr.com/photos/2332432@N06/554435234/">
<img alt="My ALT text" src="http://farm8.staticflickr.com/2213/35554564_5fhe10fj22_m.jpg"
</a>
If it can be done I would like to download both the thumbnail and the large picture but otherwise an acceptable solution would be just to download the thumbnail image (the image from farm8.staticflickr.com).
I’ve tried different approached but none have worked. One I tried was this (which I’m using to extract the Vimeo thumbnail, so therefor I thought I would work on the Flickr Thumbnail):
$ch = curl_init($the-image-url-variable);
$fp = fopen('$thename.jpg', 'wb');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
When I’m using this code, it does indeed generate an image in my folder but the image is invalid and can’t show any content..
Any help or suggestions would be appreciated.
Sincere
- Mestika