CodingPHP Dropbox/Other Cloud Services

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  ANT_THOMAS  
 To:  ALL
39722.1 

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)

0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  ANT_THOMAS     
39722.2 In reply to 39722.1 

Well I've just grabbed 1.5GB of free webspace from 000webhosting.com

 

Might do the job for the time being.

0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  ALL
39722.3 
Is it possible to do a PHP Include with arguments?

Because this doesn't work....
PHP code:
<?php include "photo.php?gallery=gallery1"?>
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  ANT_THOMAS     
39722.4 In reply to 39722.3 
I guess I don't want to include the PHP file just the output. Hmm.
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS     
39722.5 In reply to 39722.4 
Maybe investigate fread and fopen functions?

I think you can load a file over HTTP with PHP...
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Peter (BOUGHTONP)     
39722.6 In reply to 39722.5 

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.

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS     
39722.7 In reply to 39722.6 
Well if you need them stored, use a text file, but can't you just get them from a directory listing?
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Peter (BOUGHTONP)     
39722.8 In reply to 39722.7 

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.

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS     
39722.9 In reply to 39722.8 

https://www.dropbox.com/developers/reference/api
or
https://github.com/BenTheDesigner/Dropbox

0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Peter (BOUGHTONP)     
39722.10 In reply to 39722.9 

I'll look into those.

 

I have now sorted the problem with a text file but a better solution would be nice.

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS     
39722.11 In reply to 39722.10 
The latter is just a PHP wrapper around the former, though it wasn't clear if it implements all the functionality yet, and doing REST with PHP probably isn't hard and might even be a useful skill to have, so I probably wouldn't bother with the wrapper version.
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  ALL
39722.12 
Why does this output the HTML over three lines? Or maybe it's not splitting it at all?

PHP code:
echo '<a href="'.$drop.$data.'" class="fancybox"><img src="'.$drop.$data.'" width="190px" /></a>';


I want this....

HTML code:
<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>


But get this....

HTML code:
<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>
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS     
39722.13 In reply to 39722.12 

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.

0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  ALL
39722.14 
I'm about to leave work

Here's the full code if it is of interest
PHP code:
<?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>';
   	}
}
?>


I'll look into fixing it when I get home.
0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  ANT_THOMAS     
39722.15 In reply to 39722.14 
I thought you were making a dropbox like deal using PHP. I was going to tell you how much I look up to you and how you've always been my favorite. But since you're not doing that I can't say those things to you!


By reading my posts you agree to my terms of service.
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Ken (SHIELDSIT)     
39722.16 In reply to 39722.15 
Ha. That's still on Peter's to do list.
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS     
39722.17 In reply to 39722.14 
Hmmm, I'm guessing fgets includes the newline with the string, in which case you can either change that single line to this:
PHP code:
$lines[] = trim(fgets($user_file, 4096);)


Or replace the whole while loop with this:
PHP code:
$lines = preg_split( '\r?\n' , trim(fread($user_file , filesize($user_file))) );
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Ken (SHIELDSIT)     
39722.18 In reply to 39722.15 
Dan Herman already did that about ten years about. :P
0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  Peter (BOUGHTONP)     
39722.19 In reply to 39722.18 
Show me!


By reading my posts you agree to my terms of service.
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Ken (SHIELDSIT)     
39722.20 In reply to 39722.19 
http://sourceforge.net/projects/vault/
0/0
 Reply   Quote More 

Reply to All  
 

1–20  21–40  41–55

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats