For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > December 2004 > ** Any one know about an Oscommerce module to resize images on the fly? **









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ** Any one know about an Oscommerce module to resize images on the fly? **
cgu@laker.net

2004-12-23, 3:58 am

I have seen .net programs which can actually / truley resize an image
on the fly. This way, only one image is uploaded to a site (say the
larger image) and then when you view a page of thumbnails, the
thumbnails can actually be created on the fly at a specific size. This
can help a site load much quicker as some sites simply constrain an
image to a smaller thumbnail even though the end-user is downloading
the whole original large image (thus the page takes a much longer time
to load). It can be very time consuming to make 2 images (a small
thumbnail and a larger image for every image), thus I have seen a few
image manipulation programs which can do this for you on the fly on a
web site.

Has anyone seen one of these as a module plug-in / addition for
Oscommerce?

-David

Alvaro G Vicario

2004-12-23, 8:56 am

*** cgu@laker.net wrote/escribió (22 Dec 2004 23:41:30 -0800):
> I have seen .net programs which can actually / truley resize an image
> on the fly.


In my opinion, it doesn't make sense to resize an image *every time* it's
requested. When I write my own scripts I keep a thumbs directory and resize
images when they're uploaded. You can do it with PHP if you have gd libs
installed. I prefer to use ImageMagick though exec(), this piece of
software is installed in most Unix boxes.

As about osCommerce, I don't know whether there're modules for this but
it's not very difficult to patch the app yourself.



--
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
--

2004-12-28, 3:55 am

> In my opinion, it doesn't make sense to resize an image *every time* it's
> requested. When I write my own scripts I keep a thumbs directory and

resize

I agree with Alvaro on this to a degree. One part of this classic solution
that Alvaro did not mention is that you do want to add code to the script so
that it will do the resizing on the fly (IF) the image in the thumbnail
directory does not exist. There are various reasons why this image my not
exist, but the most common is that one decided to upload a batch of images
instead of one at a time (Example: 2000 new images because one started
working with a new drop shipper or other vendor). With this, you have a good
blend of performance/ease of use where you don't kill your server by
processing images on each and every request. The script does it only once.

As for OsCommerce... I do not know if a module off-hand, but I can tell you
that I recall OSC has a function or class that displays the image... You
could re-write or override that function/class to have the intended
functionality.

If you need help with the actual code, post back here with specific needs
and you shouldn't have a problem. Hmm, maybe I should just write the darn
module -- :)

____________________________________
Wil Moore III, MCP | Integrations Specialist


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com