Image gallery, for example Getty Images, but without a database

I am trying to create a gallery of images, for example, 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 just want to get the next and previous gallery. Also, so that the details below them change according to the image.

No database available.

Thanks for your help.

Lawrence

+1
source share
3 answers

Not familiar with Getty, but if you put your images in directories on your server, you can use PHP to get a list of directories, and then scroll through the list 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 an idea of ​​this, you can even write an XML file with image information and put it on the server, and then parse the XML when uploading images to deliver metadata, such as the names of the files that downloaded the file, etc.

+1
source

Even if you do not have an available database server (e.g. MySQL, PostgreSQL, ...), you should be able to use the SQLite database: the mechanism is built into PHP (via the extension, which is usually included) and the entire database is stored as a file .

This seems like the simplest solution if you already know how to develop a PHP application, and usually do it using the database as a data warehouse.

(Of course, you can also just readdir over the file system using readdir or DirectoryIterator - but using a database can make several things easier, for example, storing additional meta-information, for example)


For more information:

0
source

You can use the opendir() example for opendir() scroll files in a directory to build an array and do what you ask.

Then you can use read_exif_data() to read the image file description, header, etc. below image. This assumes the image files have exif data to read, and your php installation supports exif.

0
source

Source: https://habr.com/ru/post/1301050/


All Articles