Welcome to WebmasterWorld Guest from 54.167.85.221

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

resize and download image

     

hanyaz

8:11 pm on Jul 16, 2009 (gmt 0)

5+ Year Member



hello,
I would like to download and then resize an image with php from one server to another. Is it possible ? What would be the best way to do so ?
thanks
Yaz

NomikOS

6:35 pm on Jul 17, 2009 (gmt 0)

10+ Year Member



$content = file_get_contents($url); 
file_put_contents (PATH_TO_IMAGE . $img, $content);

$img_filename_ = PATH_TO_IMAGE . $img;
if (file_exists($img_filename_))
{
$size = getimagesize($img_filename_);
# to resize use rule of three
}

then use:
imagecreatefromjpeg (png/gif)
imagecreatetruecolor
imagejpeg (png/gif)

then upload new file with copy()

 

Featured Threads

Hot Threads This Week

Hot Threads This Month