Wotcha,

I have a shopping site with lots of products... Each one has an image of it naturally. Every time the product is mentioned the image is shown. Sometimes as a thumbnail sometimes full size.

I was planning on using GD to dynamically rezise the images using the ImageCopy Resampled function.

However I have stored the images in a MySQL DB and I dont see any way of getting something like

$src_image = imagecreatefromjpg($DB_OUTPUT['img'])

to work as it seems the imagecreatefromjpg can only accept a file as its input.

Is there any way of working around this or do I just have to store my images in a filesystem instead of a database?

MrRosary

    I had this same problem. In the end I saved couple versions of the image (S,M,L) in the database already resized. This worked fine and may work out for you.

    Right now you may have to create a temporary image file with the image's binary in the database and use functions on that, then later on destroy the file. But, you'd think a PHP could accept binary code in addition to binary files, but noooo... 🙂

      It seems almost pointless to save different sized images when php can do the resizing for me.

      on the other hand the function might be a little slow... so doing the job once might be better.

      It is bizzare that php can only accept a file name for this function. I guess if you were creating an image from scratch using GD you would start if off at the right size so resizing is a sort of bolt on.

        Write a Reply...