I'm clearly looking for something for nothing but I'll still ask.
I've got a decent lightweight PHP gallery script that I use which I think was made by Ian Gunn on here. I've been using it for years and modified it a number of times to suit whatever purpose.
I've managed to modify it in the past so the gallery would appear to be on one website but the photos would be stored elsewhere.
I'm trying to do the same now but with Dropbox being the storage space for the photos since I have plenty of space on there. Unsurprisingly this doesn't work because it won't let you run PHP scripts.
Are there any free cloud services that do support PHP and provide a consistent link like Dropbox does? (ie...http://dl.dropbox.com/u/usernumber/folder/photos/gallery1/photo1.JPG)
Well I've just grabbed 1.5GB of free webspace from 000webhosting.com
Might do the job for the time being.
<?php include "photo.php?gallery=gallery1"?>
I may just abandon this idea since I think it is overkill and the thumbnail generation isn't that nice.
I think I'll make my own thumbs and have the list of photos in a text file or database and just read from either of those.
I could do that. The sorting will already be done by filename anyway I guess.
Multiple galleries in separate folders.
Though that way I might still have to use empty files as placeholders since the actual images will be stored on Dropbox or another server. I might just stick to the text file because if I have it reading a directory it will just be using those filenames and pointing to an image elsewhere with the same filename.
https://www.dropbox.com/developers/reference/api
or
https://github.com/BenTheDesigner/Dropbox
I'll look into those.
I have now sorted the problem with a text file but a better solution would be nice.
echo '<a href="'.$drop.$data.'" class="fancybox"><img src="'.$drop.$data.'" width="190px" /></a>';
<a href="http://dl.dropbox.com/u/blah/photo1.JPG" class="fancybox"><img src="http://dl.dropbox.com/u/blah/photo1.JPG" width="190px" /></a> <a href="http://dl.dropbox.com/u/blah/photo2.JPG" class="fancybox"><img src="http://dl.dropbox.com/u/blah/photo2.JPG" width="190px" /></a> <a href="http://dl.dropbox.com/u/blah/photo3.JPG" class="fancybox"><img src="http://dl.dropbox.com/u/blah/photo3.JPG" width="190px" /></a> <a href="http://dl.dropbox.com/u/blah/photo4.JPG" class="fancybox"><img src="http://dl.dropbox.com/u/blah/photo4.JPG" width="190px" /></a> <a href="http://dl.dropbox.com/u/blah/photo5.JPG" class="fancybox"><img src="http://dl.dropbox.com/u/blah/photo5.JPG" width="190px" /></a>
<a href="http://dl.dropbox.com/u/blah/photo1.JPG
" class="fancybox"><img src="http://dl.dropbox.com/u/blah/photo1.JPG
" width="190px" /></a><a href="http://dl.dropbox.com/u/blah/photo2.JPG
" class="fancybox"><img src="http://dl.dropbox.com/u/blah/photo2.JPG
" width="190px" /></a><a href="http://dl.dropbox.com/u/blah/photo3.JPG
" class="fancybox"><img src="http://dl.dropbox.com/u/blah/photo3.JPG
" width="190px" /></a><a href="http://dl.dropbox.com/u/blah/photo4.JPG
" class="fancybox"><img src="http://dl.dropbox.com/u/blah/photo4.JPG
" width="190px" /></a><a href="http://dl.dropbox.com/u/blah/photo5.JPG" class="fancybox"><img src="http://dl.dropbox.com/u/blah/photo5.JPG" width="190px" /></a>
There's a stray linebreak on the end of each URL, so probably a stupid carriage return (\r), and thus I'd guess you're only splitting on newline (\n).
Either include an optional CR in your split (i.e. \r?\n if it's a regex), or better still set your text file (and any editors you have) to only use single-character newlines, so it doesn't even become an issue.
<?php $dropb = 'http://dl.dropbox.com/u/blah/'; $user_file = @fopen("gallery1.txt", "r"); if ($user_file) { while (!feof($user_file)) { $lines[] = fgets($user_file, 4096); } fclose($user_file); foreach($lines as $line => $data) { echo '<a href="'. $dropb .''. $data .'" class="fancybox"><img src="'. $dropb .''. $data .'" width="190px" /></a>'; } } ?>
$lines[] = trim(fgets($user_file, 4096);)
$lines = preg_split( '\r?\n' , trim(fread($user_file , filesize($user_file))) );