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))) );