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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic HTML

Status
Not open for further replies.

nychris

MIS
Dec 4, 2004
103
0
0
US
I'm not a web designer by any means, I do Unix SysAdmin work, but I need to create this one page on a site.

Lets say you have a directory called /files, that can be accessed via Inside the /files directory, you have many .jpg's. When I visit I want it to
automatically create thumbnails of every jpg in that directory. If a file is added or removed, when I click refresh to reload the page it will update the page with the additions/removals. How would you go about doing this? I think this is what PHP is used for?

Thanks

--
Chris
RHCE, SCSA, AIX5L, LPIC, CNE, CCNA, MCSE
 
Creating thumbnails dynamically with PHP quite simple to do but is also quite resource intensive, especially if you have a great number of them.

You'd be well advised to cache the thumbnails somewhere and then perform some kind of check for new images as required.
I would suggest that if it's at all possible you use a strict filenaming system so you can more easily compare what thumbnails you have already generated.

You will also need to have the GD Libraries installed in order to use PHP to create the thumbnails.


Take a look at these PHP functions.

Obviously, because this is more a PHP question you'd be better asking more detailed questions in the PHP forum (Forum434)

<honk>*:O)</honk>
Foamcow Heavy Industries - Web site design in Cheltenham and Gloucester
Ham and Jam - British & Commonwealth forces mod for Half Life 2
 
Hi

Foamcow said:
use a strict filenaming system so you can more easily compare what thumbnails you have already generated
Usually checksums are used for that purpose, typically md5 ( PHP has a function for that too. )

But I have a feeling, that Chris does not want to learn progamming for only one page.

Feherke.
 
I meant a strict filenaming system so you can easily map what thumbnail goes with what image file.

eg.

Main image = bigfatduck.jpg
Thumbnail = tn_bigfatduck.jpg
Then keep that consistent - each thumb is the original name prefixed with tn_

It might seem obvious but I've just finished working on a job where this hadn't been done and it was a nightmare with just 200 odd images.
They were things like:

Original: bigfatduck.jpg
Thumb: ayellowduckthumb003.jpg

Then another might be
Original: bluesheep.jpg
Thumb: sheepsmaller_2.jpg

It ended up being quicker to write a function to loop through all the original images and remake thumbs with consistent names in order to finish the rebuild of the site.

<honk>*:O)</honk>
Foamcow Heavy Industries - Web site design in Cheltenham and Gloucester
Ham and Jam - British & Commonwealth forces mod for Half Life 2
 
Hi

Yep, there is nothing to do with thumbnails like those.

I also worked on a site with such inconsistently named images. But renaming was not a solution as a %#!$*@ marketing people sometime renamed them when wrote some comments for the images.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top