forked from fluid-project/image-gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
42 lines (29 loc) · 2.66 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
How to install:
1. First of all, make sure you have PHP, Apache (or other web servers) and git installed.
2. Place a copy of Infusion in a Web-visible location.
3. Place a copy of the Image Gallery on your web server:
cd [webserver_document_root] -- or any folder underneath your web server document root
git clone git://github.com/fluid-project/image-gallery.git
cd image-gallery
4. In image-gallery-settings.ini, specify the path to your copy of Infusion (if it's different from the default)
5. Run the install script
dos2unix install.sh -- (Windows only) convert the installation script in DOS/MAC format to UNIX format
./install.sh -- install.sh asks for the path to your local infusion library
6. That's all. The Image Gallery is running at: http://localhost/image-gallery/image-gallery.php
How it looks:
This Image Gallery Uploader demo is composed of 3 parts:
1. the Uploader at top left
2. the image viewer at right.
3. the settings panel at bottom left.
This Uploader is configured to be progressively enhnaced. If Flash is not installed, or JavaScript is disabled, you'll
get the single file Uploader. On IE, you'll get the Flash-based multi file Uploader. On modern browsers, you'll
get an HTML5 version.
How it works:
1. When the Upload button is clicked, the client page sends an upload request to the server, along with a session token. This session token is a unique 13-character string that is generated by the front-end JavaScript. It helps the php server to distinguish the upload requests from different clients.
2. Once the PHP server receives the uploaded image, it looks up in the "temp" directory for a sub-directory
named after the specified session token. If the sub-directory does not exist, it is created. The uploaded images are placed into the sub-directory, then the server sends back the URL of the uploaded image. The client retrieves the url and adds it to the image viewer.
3. If anything goes wrong at PHP server, for instance, no file is received, session token is not provided, invalid file extension, or temp/ folder does not exist, the server returns a error message with http status code 400. The client displays the error on the page along with the name of the corresponding file.
A few constraints performed at PHP server:
1. The temporary folder is removed for sessions that are inactive for over an hour. This is performed in uploader-server.php as the first thing whenever it's called.
2. For security reason, the server only allows the upload of these file types by default, regardless of the settings on the client side: jpg, jpeg, gif, png, tif, tiff
3. Duplicate versions of the same file are rejected.