像Getty Images这样的图片库,但没有数据库 [英] Image gallery like Getty Images but with no database
问题描述
我正在尝试创建一个图片库,例如当您单击Getty Images中的图片时
http://www.gettyimages.com/Search /Search.aspx?EventId=96396247&EditorialProduct=Sport
图片: http://tinypic.com/r/efffvs/6 >
我只是想为画廊找到下一个和上一个.另外,更改了下面的细节以匹配图像.
无可用数据库.
感谢您的帮助.
劳伦斯
不熟悉Getty,但是如果将图像放在服务器上的目录中,则可以使用PHP获取目录列表,然后遍历该列表以显示图片.
$root = "/home/www/files";
if ( $handle = opendir("{$root}/altered/") )
{
## SME 05/21/2009 LOOP THROUGH THE DIRECTORY AND GET A LIST OF FILES THAT ARE NOT '.' OR '..'
while( ( $file = readdir( $handle ) ) != FALSE )
{
if( $file != '.' && $file != '..')
{
//DO SOMETHING WITH FILE
}
}
closedir($handle);
}
如果您想了解它,甚至可以编写一个带有图像信息的XML文件并将其放在服务器上,然后在加载图像时解析XML以提供元数据,例如文件名,谁上传了文件等
I am trying to create an image gallery, such as when you click an image in Getty Images
http://www.gettyimages.com/Search/Search.aspx?EventId=96396247&EditorialProduct=Sport
Image: http://tinypic.com/r/efffvs/6
I am just looking to get a next and previous for the gallery. Also that the details underneath are changed to match the image.
No database available.
Thanks for your help.
Laurence
Not familiar with Getty, but if you put your images in directories on your sever you can use PHP to get a directory listing and then loop through that listing to display the images.
$root = "/home/www/files";
if ( $handle = opendir("{$root}/altered/") )
{
## SME 05/21/2009 LOOP THROUGH THE DIRECTORY AND GET A LIST OF FILES THAT ARE NOT '.' OR '..'
while( ( $file = readdir( $handle ) ) != FALSE )
{
if( $file != '.' && $file != '..')
{
//DO SOMETHING WITH FILE
}
}
closedir($handle);
}
If you want to get fancy with it you could even write an XML file with image information and put it on the server, then parse the XML when you load the images to supply meta data such as file names, who uploaded the file, etc.
这篇关于像Getty Images这样的图片库,但没有数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!