think-digitally Posted May 20, 2008 Share Posted May 20, 2008 Hi All. I have a photo gallery script that just needs you to have a few lines of code on a page: This and <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="js/lightbox.js"></script> This are needed just once on each page <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /> Then this for each image. <a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a> I was hoping that there is some way that a PHP script could do this each time a photo is uploaded to a directory. So for instance <a href="could place the image name here" rel="lightbox" title="my caption">And a caption here</a> I was hoping that I could have some help to create a backend with an upload box and 'caption' box. When you upload it, it sends the photo to the directory, then inputs this line of script into the gallery page, along with the caption I provided. Can anyone help me? Thankyou to anyone that helps, or at least gives some tips. Regards Chris Quote Link to comment https://forums.phpfreaks.com/topic/106458-feeling-like-a-dumb-ass-please-help/ Share on other sites More sharing options...
BlueSkyIS Posted May 20, 2008 Share Posted May 20, 2008 http://www.blazonry.com/scripting/upload-size.php Quote Link to comment https://forums.phpfreaks.com/topic/106458-feeling-like-a-dumb-ass-please-help/#findComment-545659 Share on other sites More sharing options...
think-digitally Posted May 20, 2008 Author Share Posted May 20, 2008 Thanks, just read through it, this explains how to create the upload field. How would you then get this data in with the script? Quote Link to comment https://forums.phpfreaks.com/topic/106458-feeling-like-a-dumb-ass-please-help/#findComment-545664 Share on other sites More sharing options...
GingerRobot Posted May 20, 2008 Share Posted May 20, 2008 If you have access to a database, it would be easier to store the file names an captions there, rather than opening an HTML file and inserting a new image tag for each upload. Edit: And even if you dont have access to a database, it would easier to store file names and captions in a flat file, and parse that in your gallery page. Quote Link to comment https://forums.phpfreaks.com/topic/106458-feeling-like-a-dumb-ass-please-help/#findComment-545668 Share on other sites More sharing options...
think-digitally Posted May 20, 2008 Author Share Posted May 20, 2008 Ah I see The reason I am doing this to use the gallery lightroom I didnt want anything to complicated I just need a script, using a database or not, to create that line of code for each photo and place it in the script. Is it possible? Quote Link to comment https://forums.phpfreaks.com/topic/106458-feeling-like-a-dumb-ass-please-help/#findComment-545672 Share on other sites More sharing options...
GingerRobot Posted May 20, 2008 Share Posted May 20, 2008 Yes of course it is, though you're unlikely to find anything pre-written unless it came with the above gallery script. Quote Link to comment https://forums.phpfreaks.com/topic/106458-feeling-like-a-dumb-ass-please-help/#findComment-545682 Share on other sites More sharing options...
think-digitally Posted May 20, 2008 Author Share Posted May 20, 2008 Doh, I am a complete novice see Would be a hard script to write do you think? Quote Link to comment https://forums.phpfreaks.com/topic/106458-feeling-like-a-dumb-ass-please-help/#findComment-545687 Share on other sites More sharing options...
think-digitally Posted May 20, 2008 Author Share Posted May 20, 2008 Anyone else have any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/106458-feeling-like-a-dumb-ass-please-help/#findComment-545708 Share on other sites More sharing options...
MadnessRed Posted May 20, 2008 Share Posted May 20, 2008 yes ive got an idea, i need a minute to think about it though before i say basically you could sue php include i think and fwrite Quote Link to comment https://forums.phpfreaks.com/topic/106458-feeling-like-a-dumb-ass-please-help/#findComment-545890 Share on other sites More sharing options...
DeanWhitehouse Posted May 20, 2008 Share Posted May 20, 2008 i have a code that does what you want, do u want that? Quote Link to comment https://forums.phpfreaks.com/topic/106458-feeling-like-a-dumb-ass-please-help/#findComment-545898 Share on other sites More sharing options...
MadnessRed Posted May 20, 2008 Share Posted May 20, 2008 ok this is what I would do. I'm guessing you have something like <a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a> <a href="images/image-2.jpg" rel="lightbox" title="my caption">image #2</a> <a href="images/image-3.jpg" rel="lightbox" title="my caption">image #3</a> in a file. well make a new file called "imagelinks.txt" (doesn't need to be text, can be whatever you want but I use text, some people use php files. Copy all the links into that file so that file looks like this <a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a> <a href="images/image-2.jpg" rel="lightbox" title="my caption">image #2</a> <a href="images/image-3.jpg" rel="lightbox" title="my caption">image #3</a> where that bit of code was on the original document write <?php include('imagelinks.txt'); ?> when you upload imagelinks.txt chmod it to 777 thats the easy bit, the next bit i would have to see the code of the upload thing to do but I can give a basic guide. open up the upload script file now my code is probably really messed up here so hopefully someone will fix it for you but here is what it should roughly look like $il = "../path/to/imagelinks.txt" $cap = "" $imgnm = "" $imglnk = "" ^ This code you will need to edit. $cap is the caption which you will need to pick up for the upload script $imgnm is the filename, eg "image-2.jpg" $imglnk is the text that you wil use to link to the image, eg image #3 $il = "../path/to/imagelinks.txt" ^ will need changing to where ever the images directory is in relation to the upload script $f1 = "<a href='images/" $f2 = "' rel='lightbox' title='" $f3 = "'>" $f4 = "</a>" $newline = "$f1 $cap $f2 $imgnm $f3 $imglnk $f4" $handleil = fopen($il, 'w'); fwrite($handleil, $newline); ----------- I hope this helps MadnessRed Quote Link to comment https://forums.phpfreaks.com/topic/106458-feeling-like-a-dumb-ass-please-help/#findComment-545906 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.