1

Topic: Add Lightbox to image upload mod

Download Lightbox2 and unpack to folder lbox. Go to /lbox/ and copy (not cut) folder /images/ and paste to PUN_ROOT.

Now if you have installed image_upload_mod:

Open header.php

Find:
     

 echo '<link rel="stylesheet" type="text/css" href="style/imports/image_upload.css" />'."\n";

After add:
     

echo '<script type="text/javascript" src="lbox/js/prototype.js"></script>'."\n";
      echo '<script type="text/javascript" src="lbox/js/scriptaculous.js?load=effects"></script>'."\n";
      echo '<script type="text/javascript" src="lbox/js/lightbox.js"></script>'."\n";
      echo '<link rel="stylesheet" href="lbox/css/lightbox.css" type="text/css" media="screen" />'."\n";

Open image_upload.php (located in /includes/image_upload)

Find:
     

if (!$edit) $output[] = "\t\t\t\t\t\t\t\t\t<a href='postgallery.php?".
                                    "pid=$pid&filename=$url_name'>";

Replace with:
     

$source = $pid.'/';
            if (!$edit) $output[] = "\t\t\t\t\t\t\t\t\t<a href='uploads/".$source.
                                    "$url_name' rel='lightbox[roadtrip]'>";

But i have only one problem. If i upload some image with space in filename Lightbox don't work (space become +) anyone know where i can change -> to space become % ?

Sorry about my bad English wink

it's just me...

Re: Add Lightbox to image upload mod

If you use rawurlencode() on the file names I think that should change the spaces to %20 (or whatever it is) properly.

Also, the way you have your code now with the image set being called "roadtrip" for all images may cause problems. If there are multiple posts within the same page of a topic containing images, all images will be treated as one set rather than each topic having its own individual set, if that's an issue for you. A possible solution would be to use the post ID as the set name.

Looking for a certain modification for your forum? Please take a look here before posting.