开发者

PHP / MySQL image slideshows for directory listings

I am building a business directory using php/mysql and am wondering what would be the best way to set up image slideshows for the advanced business listings?

I have a mysql database of business information (over a thousand businesses) which is likely to expand in the future so I need a solution that is manageable when scaled up.

I was thinking along the lines of creating image folders for each business and then adding a series of thumbnails and full size images to this folder. I would then add the url for each image to a se开发者_Python百科parate column in my business info table in my database.

I could then use php to call the image url's from the database to insert into my page layout and control the functionality with a nice jquery effect.

Does that sound realistic?


I'm not sure how many images there are per business and if there is any special advantage to creating a folder per business, especially if you are going to have thousands in the future. It is very likely a good idea to have some full size images and some pre-built thumbnails, especially if you don't have too much user-driven photo uploading or at least if your uploading process includes the ability to automate the thumbnail generation.

Keeping the URL of the thumbnail and the full size picture in your table is a good idea. If you have multiple photos per business then you'd obviously want a child table that contains a foreign key to the business table and then the details of each photo for any particular business. If you're arranging a slide show, this child table would be where you could keep sequence information as well as anything else that might be of interest, such as a description or image caption.

There are some sites, like IMDB, that go a step further and virtualize the path to pictures. I think this must be a defense against scraping photos out of a site. If the real addresses of the photos are hard to guess, and if the photos can be served up by an http handler then you can build your pages so that the folders containing your photos are never truly revealed in your rendered HTML.

Depending on the sensitivity of your photos, you can decide whether this layer of abstraction is worthwhile.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜