Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
Nash
Regular
Regular


Joined: Jan 10, 2006
Posts: 93

PostPosted: Mon Mar 17, 2008 8:26 am Reply with quote

Hey there gents,

I'm trying to write what I think will be a very cool mod to the forum module. People often use my forum to share photos and to talk about them. In fact, I'd say a majority of posts end up with a photo in them.

I also have a photo gallery module, but over the last two years I've noticed that users have just stopped using it, in favor of posting photos in the forum, where everyone talks and discusses things anyway. They prefer to use a more "robust" photo site, like Flickr or photobucket. This is OK for purposes of conversation, but you lose the ability to view all your photos in one organized gallery.

I was thinking of a simple solution. The mod would scan any posts on the forum for pictures being posted (via link to external URL), then would grab those pictures from the external site, load them into an image directory on my site, resize thumbnails as necessary, and add them to my photo gallery's mysql tables so that they are displayed.

That is the basic algorithm, so it sounds very feasible; however I'm not too familiar with file reading/writing. I've been looking up a bit in the manual about fopen, fwrite, scandir, and some others, but I was hoping someone could just list the key functions I should look into for the various steps of this.

1) Scan the posts for image files -- should be easy enough (eregi, etc.)
2) Sanitize to make sure the image file I try to d/l is not a virus (I'm sure I can find some code in ravenuke out there I could use)
3) Get the photo file from the external website and download it to my server. (what are the functions that I would use to do this?? any example code of which you know?)
4) Resize photo as appropriate -- there's code in my gallery from which I can learn
5) Insert into sql tables -- easy as pie

Any help appreciated. Happy St. Patty's Day!

_________________
--- Nash
--- RN 7.6 v 2.02
--- GTNG installed
--- IPB forum installed and modded for Nuke 
View user's profile Send private message
Nash
PostPosted: Mon Mar 17, 2008 11:09 am Reply with quote

should add that I have seen the file upload tutorial on w3schools. Could I use that same function but somehow with a remote (http) reference instead of a local one?
 
evaders99
Former Moderator in Good Standing


Joined: Apr 30, 2004
Posts: 3221

PostPosted: Tue Mar 18, 2008 12:44 am Reply with quote

Grabbing content is fairly easy, you could use fopen or file_get_contents (assuming there is no special protection that detects if you are using a valid browser or not). It's like manipulating any other file (I believe PHP may have a setting to disallow remote files, but I don't remember it off-the-top)

_________________
- Only registered users can see links on this board! Get registered or login! -

Need help? Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Nash
PostPosted: Wed Mar 19, 2008 7:54 am Reply with quote

Thanks a lot evaders. I will mess around with these and post my code on the forum
 
Nash
PostPosted: Sun Mar 30, 2008 2:22 pm Reply with quote

OK, so here's the issue I'm anticipating running into. I don't want posters having to wait for this code to copy the file from the external server. I also don't want their post to be interrupted by it. Is there a way to pass all my relevant data to some other php file on my server that would execute it, independently of the files/page that the user is currently accessing?
 
Nash
PostPosted: Sun Mar 30, 2008 4:00 pm Reply with quote

Another problem I'm facing, now that I'm trying to implement.

Warning: copy(http://www.eastcoastbodyboarding.com/path/to/pictures/200602_wdbgo003.jpg) [function.copy]: failed to open stream: HTTP wrapper does not support writeable connections in /home/path/to/file/messageforum/sources/lib/post_parser.php on line 900


I am not too familiar with what this means
Edited by Guardian: to remove full path data to prevent it being used against in the wrong hands
 
Nash
PostPosted: Sun Mar 30, 2008 5:35 pm Reply with quote

OK so after tweaking it, this seems to come about because I was trying to write to a path defined "absolutely" i.e., with Only registered users can see links on this board! Get registered or login!

instead I had to change to be local references. This is kind of a pain, but at least it's working now!
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©