Re: Dynamic Display of Images Stored in DB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 6:12 PM -0600 11/28/07, David Giragosian wrote:
Thing is, the above works just fine as long as I hard code a switch case for
every image file pulled from the db. What I can't seem to do is dynamically
extend it to include newly uploaded images, i.e., for an image count greater
than what I've hard coded. I thought maybe something like 'eval' might be
used (I know, if eval is the answer, I'm asking the wrong question). To be
honest, I don't even know _why_ the above works because it seems that stuff
is happening as if in a while loop when there isn't one (the switch case
part).

For the moment, I'd be happy to just understand how it works as it does.
Maybe as you suggest, there is raw image data somehow being embedded in the

Unfortunately, my webbytedd.com site is down where I have an example, but I can't show code right now.

But, what I did simply was to load the images into the dB and then pull them out as needed.

As Jochem suggested, it's better to use a different script for inserting your images into a html table than it is to try to make it a function in your main script. That way you can buffer the image and call the image in via a <img> tag.

In my solution, I use two scripts. One for showing the image true size and another for generating a thumbnail -- I may be wrong, but I think it's better to generate a thumbnail as needed on the fly than it is to store both images (large and thumbnail) in the dB.

As for a counter, that value can come directly from your dB. You can either find out how many images there are in your dB and set a counter to that figure OR draw the images out via a LIMIT -- either way, there's no need to hard code a limit.

You can still use your switch because it is based upon image type, which is a good idea -- if you're going to store different image types in your dB.

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux