用于目录列表的 PHP / MySQL 图像幻灯片
我正在使用 php/mysql 构建一个业务目录,并且想知道为高级业务列表设置图像幻灯片的最佳方法是什么?
我有一个包含业务信息(超过一千个企业)的 mysql 数据库,该数据库将来可能会扩展,因此我需要一个在扩展时易于管理的解决方案。
我正在考虑为每个企业创建图像文件夹,然后向该文件夹添加一系列缩略图和全尺寸图像。然后,我会将每个图像的 url 添加到数据库中业务信息表的单独列中。
然后,我可以使用 php 从数据库调用图像 url,将其插入到我的页面布局中,并使用漂亮的 jquery 效果控制功能。
这听起来现实吗?
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 separate 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定每个企业有多少图像,以及为每个企业创建一个文件夹是否有任何特殊优势,特别是如果您将来会有数千个图像。拥有一些全尺寸图像和一些预先构建的缩略图很可能是个好主意,特别是如果您没有太多用户驱动的照片上传,或者至少如果您的上传过程包括自动生成缩略图的功能。
将缩略图和全尺寸图片的 URL 保留在表格中是一个好主意。如果每个企业有多张照片,那么您显然需要一个子表,其中包含该企业表的外键以及任何特定企业的每张照片的详细信息。如果您要安排幻灯片放映,则可以在该子表中保存序列信息以及任何其他可能感兴趣的内容,例如描述或图像标题。
有些网站(例如 IMDB)更进一步,虚拟化图片路径。我认为这一定是为了防止从网站上抓取照片。如果照片的真实地址很难猜测,并且如果照片可以由 http 处理程序提供,那么您可以构建页面,以便包含照片的文件夹永远不会在渲染的 HTML 中真正显示。
根据照片的敏感度,您可以决定这一层抽象是否值得。
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.