%[if !edit]% Error
CSV File "' . $fileName . '" Not Found.
You might be trying to preview this page in RapidWeaver, but the CSV file to your gallery could not be located. This could simply be because the CSV file is on your web server, and RapidWeaver is unable to access it currently. You could try adding the CSV file as a resource in the RapidWeaver sidebar and then link to that instead. This will then let you test and view the gallery in RapidWeaver preview.
Alternatively if you are seeing this error on your live (published) webpage, then the relative path you have specified to the CSV file is incorrect or the CSV file is not presented in a format that ProGallery understands. Please refer back to your documentation for complete setup instructions and examples of CSV files.
'; } else { $title = $data[0]; $imgthumb = $data[1]; $fullmedia = $data[2]; $retinaimg = $data[3]; $caption = $data[4]; $altlink = $data[5]; while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $title = $data[0]; $imgthumb = $data[1]; $fullmedia = $data[2]; $retinaimg = $data[3]; $caption = $data[4]; $altlink = $data[5]; echo('A CSV (or comma separated value) file is an extremely simple spreadsheet format. In ProGallery, a CSV file acts like a database; letting you store detailed information about your gallery. This ProGallery source lets you specify full titles and captions, combined with the flexibility of using images or video from different locations.
CSV files are easy to create in a code editor or with spreadsheet software like LibreOffice, OpenOffice, Google Docs or Apple Numbers. However we do not recommend using Excel, because Excel often adds extra code, meta data and non-standardised characters that can corrupt the CSV file.
In the source settings, provide the relative path to the CSV file containing your gallery data. What is a relative path? PHP is a server-side programming language and can't interpret normal web links in the same way you see them. This is partly done for improved security and faster performance. The webpage that the PHP code runs on (in other words the page you put ProGallery on) is known as the current working directory. If your ProGallery page is not located on the homepage of the website AND the CSV is not in the same working directory as ProGallery, you will need to provide a more concise relative path to the CSV file. Lots of information about relative paths can be found online. In essence, you enter ../
to step-back however many directory levels is required, towards the website homepage. Then you can specify the path to the directory containing the CSV file. A possible example of a relative path to your CSV file might look like ../../data/gallery.csv
.
In your spreadsheet software or code editor, the CSV file will typically look like this:
Title, | Thumbnail image link, | Normal image or video link, | Retina image link, | Image or video caption, | Non-lightbox link |
Image Title, | ../pathto/img/thumb-1.jpg, | ../pathto/img/image-1.jpg, | ../pathto/img/image-1@2x.jpg, | Caption content goes here, | http://example.com |
Image Title, | ../pathto/img/thumb-2.jpg, | ../pathto/img/image-2.jpg, | ../pathto/img/image-2@2x.jpg, | Caption content goes here, | http://example.com |
Image Title, | ../pathto/img/thumb-3.jpg, | ../pathto/img/image-3.jpg, | ../pathto/img/image-3@2x.jpg, | Caption content goes here, | http://example.com |
Image Title, | ../pathto/img/thumb-4.jpg, | ../pathto/img/image-4.jpg, | ../pathto/img/image-4@2x.jpg, | Caption content goes here, | http://example.com |
Image Title, | ../pathto/img/thumb-5.jpg, | ../pathto/img/image-5.jpg, | ../pathto/img/image-5@2x.jpg, | Caption content goes here, | http://example.com |
Image Title, | ../pathto/img/thumb-6.jpg, | ../pathto/img/image-6.jpg, | ../pathto/img/image-6@2x.jpg, | Caption content goes here, | http://example.com |
An example CSV file is also available to download from the ProGallery page on the Stacks4Stacks website. As you can see from the above, each data cell ends with a comma, except the data in the right-most column. All columns (except Retina image link and Non-lightbox link) are mandatory (required). You are welcome to leave the retina image link and non-lightbox link columns empty, but just leave any commas intact to denote the cell is empty.
Dealing with commas in CSV cells is relatively easy. It might be that you find yourself in a position whereby titles or captions need to include commas or other special characters. Normally these could break the CSV file, because the parser would treat the words either side of a comma as new cells. If you spreadsheet software provides the option to use a Text Delimiter when you export the CSV file, this can be set to double quotes. Alternatively if you are manually coding the CSV file yourself in a plain text editor, you can wrap any cells that contain commas inside double quotes yourself.
In the case of creating an image gallery, ideally you would create a separate thumbnail images and full size images. Those thumbnail images could be rescaled versions of the full size images; to promote faster page loading and less bandwidth. However if you prefer, you can use the same image for both the thumbnail and full size images.
To get high-resolution images displaying on retina displays, you will need to provide links to images that are double the width and height of the standard images (retina images remain at 72 dpi). In the source settings, check the Hi-Res Image Support checkbox. Now the markup of the gallery will be changed to ensure the higher resolution images you supply are available for retina displays to use.
Video is supported too! Instead of providing a link to normal image (third column), enter the URL to a suitable video instead. A thumbnail image will still be required, as a method to click and open the video.