Jump to content

Create thumbnails from external images?


Guldstrand

Recommended Posts

I need some advice / tips for a function that can create thumbnails (2 different sizes) from an external image (url), then save the file name/path in mysql.

 

I´m working with a small portal for webcams, and I need to be able to download cam images (usually. Jpg) from users own websites, and then create thumbnails of them.

 

Preferably any function that does not require too much of my server (RAM, CPU and bandwidth).

Link to comment
https://forums.phpfreaks.com/topic/166656-create-thumbnails-from-external-images/
Share on other sites

I made this code, you will have modify it some to get it to do what you want it to do:

 

http://beta.phpsnips.com/snippet.php?id=61

 

But it grabs an image from some web site and displays it. To save it, you need to add/Change these values:

 

Change "NULL" to a file name for a jpg:

imagejpeg($thumbImg, NULL, 100);

 

Add a second parameter for a gif:

imagegif($thumbImg);

 

Change "NULL" to a file name for a png:

imagepng($thumbImg, NULL, 9, PNG_ALL_FILTERS);

 

Hope this helps!

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.