Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving pictures from the web onto your server (GD problem)

Status
Not open for further replies.

748323

Programmer
Dec 10, 2004
70
US
I made this script. It is supposed to copy the image, and save it on my server. For the most part, it does do what's its supposed to do.
Code:
<?

$image = imagecreatefromjpeg("[URL unfurl="true"]http://www.rareteens.com/teen/met50/2.jpg");[/URL]
imagejpeg($image, "pic.jpg");

?>
This would load the picture, and save it on my server. The only problem is that it only saved half it on my server. I'm assuming it ran out of memory to place the colors in and just made the rest of the pixels white. How can I bypass this?

This is what the script gives me:

Thanks.
 

If you can open a URL with the imagecreatefromjpeg() function, you can certainly open a URL with the copy() function.

If your goal is to copy the file onto your server, I don't see any point of running it through the GD libraries.


I assume, of course, that your copying of the images does not violate copyright law.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top