开发者

Preparing GD dynamic image for upload

How can I prepare a dynamic image created by GD for upload?

I created a php script to create dynamic images based on the userid (EX: www.mywebsite.com/image/124.png <== that should show the user 124 info)

Now I need to upload it to Facebook with this script :

$photo_details = array(
    'message'=> $message
);
$file = "$_GET[id].png";
$photo_details['image'] = '@/home/username/public_html/image/' . $file;
$upload_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);

When开发者_JS百科 I use the upload script that way I get this error:

Fatal error: Uncaught CurlException: 26: failed creating formpost data

But If I uploaded 124.png to /image/ directory and and tried the same code again with using the ID 124 it works just fine. After a long research I came to conclusion the problem relay in the dynamic part since it works just fine with static images. How can I solve this problem?

Thank you so much for all the help.


Looks like the script tries to read the file directly from the filesystem instead of running the image generating script. You can solve this by setting $photo_details['image'] = 'http://www.mywebsite.com/image/'.$file; if Facebook class allows this kind of file opening.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜