Olivier Sirven
unread,Apr 22, 2013, 5:17:31 AM4/22/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Fotol...@googlegroups.com
Hi,
On 2013-04-20 12:51:07, AndreasE wrote:
> i tryed this:
>
> $imagedata = $api->getMediaComp($key['id']);
>
> $api->downloadMediaComp($imagedata['url'], 'imgs/'.$key['id'].'.jpg');
> this works, but all images with the small fotolia watermarks.
Just try this:
--8<---------------cut here---------------start------------->8---
<?php
// login first to make sure no watermarks are displayed
$api->loginUser('login', 'password');
// retrieve the comp url
$comp_url = $api->getMediaComp($key['id']);
// download and display it or save it to a file
$file_path = null; // if not null the file file be saved under this file name
$api->downloadMediaComp($comp_url, $file_path);
--8<---------------cut here---------------end--------------->8---
> if i try this:
>
> $url=$imagedata['url'];
> $img = '/imgs/'.$key['id'].'.jpg';
>
> $ch = curl_init($url);
> $fp = fopen($img, 'w');
> curl_setopt($ch, CURLOPT_FILE, $fp);
> curl_setopt($ch, CURLOPT_HEADER, 0);
> curl_exec($ch);
> curl_close($ch);
> fclose($fp);
>
> every Comp image on my server has 0 bytes size :-(
that's because that's not the proper way to retrieve them, just take a
look at fotolia-api file to check how it's supposed to be done
--
Oliv