Topic: PHP Image retrieval efficient

What is the most efficient way to have images stored and called on a site....

Scenario...
Say I have 75,000 images split between 15,000-20,000 (so average 4 per a section/topic).

My questions...
How should I store these images? and also how should I call the images to the page?

My idea...
Would having the filenames in my database and having all the images in one folder be efficient.

On that point... if I stored the filenames like so....

image1.jpg|image2.jpg|image3.jpg

Then use PHP to split and sort the list of images.


Any ideas.... Many thanks

Re: PHP Image retrieval efficient

You need to explain more: what are these images, how many are loaded on a given page, how do you pick which filenames to load, etc. Right now, all we know is you have a bunch of images and want to load some subset of them under some circumstances. That's too general to really recommend anything.

3 (edited by StevenBullen 2008-04-24 10:51)

Re: PHP Image retrieval efficient

I will try to explain a little better. tongue

I will start again. Instead of questions I will say what my intention is and maybe you could point out any faults in it.


I will have two folders. Each folder will contain 20,000 images.

/img/thumbs/***
/img/full/***

Then using PunBB for example.
I would add a field to the 'topics' table called 'images'. My entry for images on one of my topics would be...

image1.jpg|image2.jpg|image3.jpg

Then to use these images I would use PHP to call the topics.images entry. I would then explode the string and paste the code like so. (Rough example below.. I would put it in a loop for all the array entries)

<a href="/img/full/<?php echo $topics.images[0] ?>"><img src="/img/full/<?php echo $topics.images[0] ?>" /></a>

That is the plan I have. I dont see a fault in it... I was just wondering if there is a more efficient way of doing it.
Hope that helps...

I think I have answered your other questions above. Apart from...

Smartys wrote:

how many are loaded on a given page

6 Max.

4 (edited by MattF 2008-04-27 19:48)

Re: PHP Image retrieval efficient

If it's any use, that'd probably be the way I'd do the same. smile

Re: PHP Image retrieval efficient

It would be interested to see some type of ajax with a php script to handle the loading of all images.

I like my lightbox gallery script but the caching of the files will slow down if there is a lot of images in a folder.

images.jpg | th_images.jpg then add number 01 02 03

Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: PHP Image retrieval efficient

I would take advantage of the fact that I'm using a database and normalize the data tongue
So, add a topic_images table which has an image_id, a topic_id, and an image_name. Then fetch all the images that have the same topic ID as the topic you're viewing and display them. smile

7 (edited by MattF 2008-04-27 22:43)

Re: PHP Image retrieval efficient

That'd be using the same method as you suggested, ( and which I did implement, cheers again for that advice, smile ), for the download mod to cater for multiple download locations, would it not?

Re: PHP Image retrieval efficient

i have a simple gallery script that i have used on several sites that is like 5 or 6 files.  and it has a admin panel to create categories and such.

http://256studio.com/gallery.php

it requires a sql db...

Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

9

Re: PHP Image retrieval efficient

Just as a slight aside quaker, it may be worthwhile making the random image thumbnail in the left column link to its respective fullsize picture, or the associated gallery.

Re: PHP Image retrieval efficient

MattF wrote:

That'd be using the same method as you suggested, ( and which I did implement, cheers again for that advice, smile ), for the download mod to cater for multiple download locations, would it not?

If my memory serves, then yes smile

11

Re: PHP Image retrieval efficient

mattf, i just used a simple random image script. and pulls from a predefined location. so all i do is drop new pics in.. that it.


Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!