Forums

This topic is locked

Display thumbnail images from a database

Posted 04 Jul 2010 07:14:36
1
has voted
04 Jul 2010 07:14:36 Magdolna Szilagyi posted:
I've read your tutorial in page www.dmxzone.com/go?14202 that was :
<img src="../images/thumb_"<?php echo $row_rsImages['ImageFile']; ?> />

This is in case we use a prefix ' thumb_ '.

What about a suffix ? I use: _small.jpg . How can I display thumbnail images from a database in this case ?

Thank You for any help
Maddalena

Replies

Replied 05 Jul 2010 11:07:23
05 Jul 2010 11:07:23 Patrick Woldberg replied:
is it always a jpeg?

you could try:

<img src="../images/<?php echo substr($row_rsImages['ImageFile'], 0, -4); ?>_small.jpg" />


the substr function just strips off the last 4 characters, a more secure way is to search for the last dot, but I think mostly the files have an extension of 3 charaters, 4 including the dot.

Reply to this topic