Jump to content

GD Image Library Question URL...


rckehoe

Recommended Posts

curl cannot resize an image, can it?

The whole point of what I am doing is to be able to resize the image, then save it on the server, so I don't have to download the image, then resize, then re-save it back to the server and delete the old one... I just think that is way to many steps and will take longer to execute the code.

cUrl can be used to download a image into a $variable just like file_get_contents.

 

Like this :

 

<?php
$image = file_get_contents('http://www.example.com/image.gif');

$im = imagecreatefromstring($image);


....
/* resize / save the thumb */
....

imagedestroy($im);
?>

 

You can use cUrl to do the same jobs but with better error handling than file_get_contents.

 

Axeia have told that if gd functions can't read a URL like this :

<?php
$im = imagecreatefromjpeg('http://www.example.com/image.jpg');
...
?>

 

You can use others function to pull the image, like file_get_contents or cUrl.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.