Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help with Thumbnails


playy

Recommended Posts

Posted

Here is my problem:

 

My site is currently live and receiving a large amount of traffic, the problem is, my images are so large no one is willing to wait to download them. I currently have my images coming directly from an outside website (they are not saved at all on my server).

 

I have tried every single image resizer and thumbnail creator in the contributions section with no success, because they all use images saved on your server, not outside images.

 

Does anyone know how I can create jpg thumbnails out of these images without saving them on my server (there are thousands of images)

 

If you need to look at the site it is:

 

 

http://www.getawatch.com

Posted

Do you mean you want to store the thumbnails on your site but not the original images?

Posted

if I correctly understand what you said, you can use this piece of code from bpiere21 et hotmail dot com on www.php.net

 

###--- imagecreatefromjpeg only opens JPEG files from your disk.

###--- To load JPEG images from a URL, use the function below.

 

function LoadJPEG ($imgURL) {

 

##-- Get Image file from Port 80 --##

$fp = fopen($imgURL, "r");

$imageFile = fread ($fp, 3000000);

fclose($fp);

 

##-- Create a temporary file on disk --##

$tmpfname = tempnam ("/temp", "IMG");

 

##-- Put image data into the temp file --##

$fp = fopen($tmpfname, "w");

fwrite($fp, $imageFile);

fclose($fp);

 

##-- Load Image from Disk with GD library --##

$im = imagecreatefromjpeg ($tmpfname);

 

##-- Delete Temporary File --##

unlink($tmpfname);

 

##-- Check for errors --##

if (!$im) {

print "Could not create JPEG image $imgURL";

}

 

return $im;

}

 

$imageData = LoadJPEG("http://www.example.com/example.jpg");

 

Header( "Content-Type: image/jpeg");

 

imagejpeg($imageData, '', 100);

 

###########

 

With this, you could open your pictures, resize them (imagecopyresized) , and store the thumbnails on your server by usign (imagejpeg).

You could probably find already coded script on the net for this.

 

hope it helps.

Posted

Yes, I would like to create thumbnails and store them on my server, but not store the images. The images are actually bitmap images, and I want the thumbs in jpg format.

Posted
Yes, I would like to create thumbnails and store them on my server, but not store the images. The images are actually bitmap images, and I want the thumbs in jpg format.

You should not use bitmap images - convert them to a format suitable for the web :blink:

 

Search 'thumbnail' in the contributions section - there is at least one contribution that will create and store the thumbs.

 

Matti

Posted
Search 'thumbnail' in the contributions section - there is at least one contribution that will create and store the thumbs.

 

I think no contribution could create thumbnails from bitmap format, because no PHP function could do this. As this is not a standard web format, the only way to do is to download file then convert and resize them with a picture software.

 

You also could find executable that make the conversion and run it from PHP with system() fonction, but it will probably be slow.

Archived

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

×
×
  • Create New...