Free PHP Lightbox Photo Gallery Script
PHP Lightbox Photo Gallery Script v 1.0 is a free php gallery I developed for my own needs and since I am a good person I would like to share it with you.

It uses a lightbox script based on the jQuery library.
Features:
- it can calculate the size of the images;
- automatic thumbnail generation;
-password protected administration interface;
-quick and easy installation;
I am looking forward to improve this script, depending on how many downloads I get. If there are more than 500 unique downloads, the 1.1 version will have a lot of features like: template system, albums and categories, multi level administrators, user submissions, image voting, image comments, easy integration with scripts like osCommerce, WordPress, Joomla and PHPNuke etc.




on May 13th, 2008 at 5:29 pm
Comments are highly appreciated and help keeping this blog alive!
on May 15th, 2008 at 6:21 pm
When i open install.php in my browser nothing happens….
more people got this problem?
on May 16th, 2008 at 3:39 pm
worked like a treat, shame the admin section is so basic and things like seperate galleries can not be made. Great basic script though.
on May 16th, 2008 at 3:49 pm
If this basic script will get more than 1k downloads, the second version will have a lot more cool features and it’ll be easy to integrate with most os scripts.
I’m glad you like it.
on May 21st, 2008 at 8:54 am
Great Script! The only downside is the admin section though.
One thing, what makes a person good?
on May 22nd, 2008 at 8:20 am
: Call to undefined function imagecreatetruecolor() in xxxxxx.process_images.php on line 96
any help ???
on May 22nd, 2008 at 8:37 am
Depending on your PHP and GD versions this function is defined or not. With PHP 4.0.6 through 4.1.x this function always exists if the GD module is loaded, but calling it without GD2 being installed PHP will issue a fatal error and exit. With PHP 4.2.x this behaviour is different in issuing a warning instead of an error. Other versions only define this function, if the correct GD version is installed.
More info here.
Thank you for downloading this script.
on May 22nd, 2008 at 9:44 am
am using PHP Version 5.2.0
wat is GD ??
on May 22nd, 2008 at 10:02 am
GD is a graphics library for fast image creation. Ask your server admin if the GD php module is loaded, if it’s not, tell him to load it for you.
If you are the server admin, you would like to take a look on this website: http://www.php.net/manual/en/intro.image.php
on May 22nd, 2008 at 10:16 am
tanx 4 t info
on May 23rd, 2008 at 10:39 pm
Hi badeziner,
i have downloaded your script. And i have to say…its very very nice! But i have a little problem. Im not a pro in this so it can be a stupid thing. But i have putted the files on my ftp plus the gallery and prettyPhoto map in the existing images map. Now i can log in and upload images. But i dont know wich script put the images in a map?
And if I want them to delete there is an error:
Warning: unlink($imagesimages/test.jpg) No such file or directory in /home/thijsena/public_html/admin/process_images.php on line 51. So if i understand it correctly it cant find the images in the root?:
CONFIG.INC.PHP
define('SRV_ROOT', 'images');PROCESS_IMAGES
// remove the image and thumbnail
if ($row['pict_path']) {
unlink(SRV_ROOT . ‘images/’ . $row['pict_path']);
unlink(SRV_ROOT . ‘images/’ . $row['pict_thumb']);
wich root i should define?
on May 23rd, 2008 at 11:49 pm
I am glad you like the script. The SRV_ROOT contant must have the full server path set to it, for example: /home/user/www/images/
You can find this path by putting < ?php phpinfo(); ?> in a file, load it on the server in the images directory and run the file in a browser. Look for _ENV["DOCUMENT_ROOT"] and there you’ll see the server root for that folder.
on May 24th, 2008 at 12:15 am
WOW!!!
Finally it worked!! Thank you very much badeziner!
on May 26th, 2008 at 8:57 am
Very nice script. I would dearly like to see a category/album field.
Regards
on May 26th, 2008 at 11:29 am
Hi downloaded and install the software but I do not know admin section user name and password please advice thanks
on May 26th, 2008 at 12:47 pm
I am glad you like it.
Those features and many others will be available in the new version which will be developed after this version reaches 1000 unique downloads.
on May 26th, 2008 at 12:50 pm
In config.inc.php, line 19 looks like this define(’ADMIN_PW’, ‘password‘); Replace the password word with your desired passwords and it should work if everything else is ok.
Thank you for downloading.
on May 26th, 2008 at 1:34 pm
Hi
Thanks for your reply
what line point to the username in the config.php still can log in to the admin
on May 26th, 2008 at 3:30 pm
you don’t need a username, just insert the password desired in the config.inc.php and then go to http://www.example.com/path-to-the-gallery-script/admin/ and insert the pw from the config.inc.php.
on May 26th, 2008 at 4:25 pm
What i am doing wrong?
I can’t delete any images…
SELECT pict_path, pict_thumb FROM Gallery WHERE pict_id = 35
on May 26th, 2008 at 4:32 pm
make sure you installed the script correctly. Check the config.inc.php file, and make sure that the information requested there is correct (mysql server, db, user, pw and server path to the images directory).
Also you can try truncating the database tables to remove everything stored in the gallery databse.
thank you for downloading.
on May 28th, 2008 at 6:56 pm
Hi
Where in your script I can making changes to do this:
Original image is reduced in size to fit the selected thumbnail width and height ? (ex. 162×99 Wide and Tall image of Thumbnail image will be the same size)
Regards
on May 28th, 2008 at 8:50 pm
in config.inc.php there are three constants which are related to the size of the images: THUMBNAIL_WIDTH, LIMIT_WIDTH and MAX_IMAGE_WIDTH. Each one of these, like their name states, does something to the images. If you want to have thumbnails with 150px width you would insert 150 in the THUMBNAIL_WIDTH constant.
The height is automatically calculated.
I hope this answers your question.
on May 29th, 2008 at 7:45 pm
Simply perfect !!!
Thanks
on May 29th, 2008 at 9:29 pm
glad you like it.
on May 31st, 2008 at 3:18 pm
Hi Badeziner,
It’s Leonie again. I have installed your lightbox into my website. The only problem i have is that the image is not shown in the lightbox. You can click on the image, but then its only loading a white screen with no photo in it. I think it can’t find the image source:
(src=”" )
(i used firebug for it)
div class=”content” style=”overflow: hidden; height: 135px; display: block;”>nextprevious<div class=”details clearfix” style=”width: 166px; display: block;
Can you help me?
Thnx.
on May 31st, 2008 at 3:21 pm
Haha the post is making a link:
Another try..
on May 31st, 2008 at 3:22 pm
img id=”fullResImage” style=”display: none;” src=”"
on June 1st, 2008 at 7:52 pm
it would help if you could post a comment with a link to your website.
on June 2nd, 2008 at 11:36 am
Yeah sure:
http://www.thijsenaafke.nl/fotos.php
I copied your source index.php into fotos.php
This is your index.php
http://www.thijsenaafke.nl/index1.php
And another question: can i have your permission to remove your lovely copyright?
on June 2nd, 2008 at 11:37 am
hmm i cant see my posts?!
on June 2nd, 2008 at 11:39 am
Ok so i cant post my question. I putted it in the website area. And can i have your permission to remove your lovely copyright?
on June 2nd, 2008 at 5:05 pm
You are not allowed to remove the copyright unless you make a donation, otherwise the script will remain under the gnu gpl license and you’ll have to keep that copyright at the bottom of the page. You are allowed to alter the copyright text as long as it remains visible.
on June 3rd, 2008 at 11:52 pm
Actually having a problem with the script. Not sure if it’s an error in my setup or the hosting. But after clicked on thumbnail the pinwheel won’t go away and the larger version doesn’t load properly or at all.
Any advice–please email me directly at sarah.flickfoto [at] gmail dt com.
Thanks!
on June 5th, 2008 at 2:01 am
Good Evening Badeziner: Fabulous project to date! I am sitting on the sidelines, dearly needing the vote feature you mentioned after #downloads. I also have a priority to allow anyone to upload pictures to one of 5 albums within the gallery, and finally to have a check box allowing any visitor to render any new picture invisible, if they feel it is inappropriate, until it is reviewed by an administrator …too big a stretch?
on June 5th, 2008 at 6:44 am
yes, those are just a few of the features i thought of, thank you for suggesting them. if you have any other ideas, you are welcome to write them here.
I also had in mind a templating system(something based on smarty maybe) and more.
on June 5th, 2008 at 2:39 pm
The gallery reached 500+ downloads. The development for the new version(v1.1) will start on 1st of july 2008 and it’ll end in about 25-30 days.
Thank you for using this script.
on June 6th, 2008 at 7:30 pm
Is there a way to incorporate highslide (http://vikjavev.no/highslide/) instead of lightbox?
on June 6th, 2008 at 8:50 pm
Yeah, it is possible. Take a look at the code inside index.php around lines17/18 and around line 36. You have to replace the code in these lines with the highslide code.
Good Luck.
on June 17th, 2008 at 3:15 pm
When i delete picture in my admin nothing happens….
1146 - Table ‘db9511xsvarny.Gallery’ doesn’t exist
on June 17th, 2008 at 3:28 pm
Make sure you have installed your script correctly.
on June 19th, 2008 at 10:44 pm
I’m not sure what to put for the mySQL server in the config.inc.php file. what does an example of that look like so i know what to look for on my control panel? thanks
on June 20th, 2008 at 12:36 am
You have to insert the mysql server address, the mysql username, password and database.
on June 20th, 2008 at 12:48 am
Thanks for the reply. I have the username, password and database but wasn’t sure about the mysql server address, but I think you clarified it. I’ll ask my server admin if I can’t find it
on June 20th, 2008 at 12:51 am
No problem. Make sure you keep the copyright at the bottom of the page so that others can find out about this free script as well.
on June 20th, 2008 at 5:14 am
problem in deleting pictures from admin panel.
1146 - Table ‘gallery.Gallery’ doesn’t exist
SELECT pict_path, pict_thumb FROM Gallery WHERE pict_id = 34
[TEP STOP]
solution :
* in your “process_images.php” file inside admin directory
in line 43 “FROM Gallery”
change the “FROM Gallery” into “FROM gallery”, changing the capital “G” from gallery into small letter “g” solves the problem in deleting. i guess Gallery-gallery was a table from the database?
am i right badeziner?
thanks for this nice script.
on June 20th, 2008 at 8:19 am
Yeah, you are right, there is a capital g and there shouldn’t be one.
What operating system are you using, because I have tested it on both linux and windows and there were no problems like yours.
Thanks for pointing that out.
on June 22nd, 2008 at 4:14 am
Thanks for sharing! Looking foward to use it
on June 23rd, 2008 at 4:44 am
@badeziner
i’m using fedora 7 with php 5.2.4
on July 1st, 2008 at 10:00 pm
Great script, but i have a question. i have been poking around the code, and could not seem to find out how to get the picture name to show up. ideally, i would love to have it show up during the slideshow next to the picture count…that way i could also add some other info such as painting size, paint type etc. any help would be appreciated. thanks
on July 2nd, 2008 at 10:12 am
Hi. Great script. Thanks for all your effort into it. I just have one question…..is it possible to drop another image into the bottom of the div where the close button is. I would like to dynamically show a ‘product logo’, which will change with each photo as well as aperture information and the likes!
Really need some guidance on this!
on July 2nd, 2008 at 10:13 am
mmm…mewho and I have similar requests!
on July 2nd, 2008 at 1:09 pm
I’ll have a look as soon as I get home.
on July 2nd, 2008 at 4:22 pm
Thanks!
on July 5th, 2008 at 1:14 am
Hello! I have downloaded ‘ThinBlue’ from OScommerce addons.
I was actually looking for an addon for the product info page, so that I could have one large (default) image, and several other optional images (product options in colors), as thumbnails adjacent to the default image. When a customer clicks on a thumbnail,it expands and replaces the default image. When the customer ‘mouse_over’ the default image, (or what ever image has replaced it), it resizes to an even larger image (as specified in a style sheet).
I have searched the net over, and over… found a solution, BUT that solution was designed for ZEN-cart. … it is named ‘Image-Swapper’.
I wonder, the files included in ‘Thinblue’ is it a total replacement of my MS2.2 V2,,, ? Which will give me that feature? Since my version is heavily modified (I have worked on it for months), are there parts of ‘Thinblue’ I can install in my shop? I am not a coder, more of a business woman and visionaire, so I also wonder if there is any assistans on this?
And, the worst part of OScommerce is managing of products. I have an sketching an a much better alternative, for one thing the attributes should be set on the same page where new products are added. And most of it can be done as ‘auto load’. If it will work, it will be the best addon ever found.
I appreciate all of your hard work and honors your efforts and, ‘as a thank you so much’ I include a link to a place where a nice template system and examples can be found:
http://webempoweredchurch.com/gettingstarted/templates/
Warm regards from Sweden
Sara
on July 5th, 2008 at 9:29 am
Thin Blue does not have that feature installed.
on July 10th, 2008 at 12:30 pm
to mewho ….and anyone else. Just a nice solution to my request that I did. Used a tooltip and put all image info into that rather than on the ‘pop up’. Use the thought or dont but it worked for me and looked quite slick!
Once again, thanks Badeziner for this totally wicked script!
on July 10th, 2008 at 3:37 pm
Rob thx for sharing. Stand by, a new version of the script will be released soon.
on July 10th, 2008 at 11:07 pm
Hey,
Just wanted to say that it would be worth gold if you included a crop thing, so the thumbnails will be like 150×150pm without shrinking the image or what ever size they want on the thumbnails.
I would be happy if you could contact me.
If you’re doing custom jobs. Paying.
Thanks
on August 3rd, 2008 at 9:09 am
Hey, This is a very nice tool. I was able to get it setup in no time, and I was able to get it workign with a different lightbox script using the Prototype and scriptaculous .js’s
Thank you VERY much for making it, I love PHP to death it is sooo amazing what you can do with it.
Im really excited about your next version of this.
Are you going to add video support?
What About Different Gallery support? So A gallery about chickens and a Gallery about fish Ya know? Separate links maybe?
Right now I have to install it many times over in order to Separate the different galleries.. which is fine.
Please stick with the PHPness of this either way, as anyone I know HATES making a different link for each image, sometimes forgetting to add the rel”" attribute.
Especially if you have like 800 images you have to share.. UHG!
The good thing about installign this multiple times, I can use different Lightbox effects if I install a different .js
Is there a way to implement that on a per image basis maybe? Like for instance, I have 50 pics all the same size and shape, I have it set to rotate between different neat effects for each picture.
Like, the one I was just Viewing, shrinks away Left to right, then top to bottom, then the next one scales back in a different way.
It would be cool if it could just randomly pick a transition.
Just wishfull thinking.
Otherwise..
THANKS!!!
Terry
p.s What about some kind of image sniffer? I point it to a directory and it sniffs out all the images, resizes them, makes a thumbnail, puts them in order of creation date, then an admin section where I can add comments later.
THAT WOULD BE AWESOME!!!
on August 3rd, 2008 at 11:04 am
Thank you for your advices Terry. I will take them into consideration. If you have more ideas, you’re welcome to share them with me.
on August 4th, 2008 at 8:34 am
This is a great script. When can we expect the new version with albums/categories. That would fit my purpose perfectly and make it wicked cool.
Maybe you can have a feature wishlist kind of thing?
on August 8th, 2008 at 10:06 am
Hi,
Great script. I’ve been searching for some time for a lightbox script that was easy to set up and I seem to have found it.
I have a problem however. All went well with the installation and I succeeded in getting into the admin. On trying to upload an image however, I get this error after submitting the image:
Fatal error: Call to undefined function imageantialias() in /home/XXXXXXXXX/public_html/gallery/admin/process_images.php on line 97.
Looking in the functions page I can’t see a function called imageantialias(). I’d be really grateful of your help in this matter.
Best wishes,
John
on August 8th, 2008 at 1:02 pm
make sure you have all the necessary libs installed on your server.
on August 9th, 2008 at 6:06 pm
Thanks for your reply badeziner.
I’ve been through the documentation and I can’t find any ref to any necessary libs that I might need installed on the server. Could you just point me in the right direction here please.
Many thanks,
John
on August 10th, 2008 at 7:54 am
Hey you might not have the gd2.ini enabled on your server..
Find the line named ;extension=php_gd2.dll
and remove the ; then restart your server.
Thats what that looks like to me.
The imageantialias() is a function that calls to the GD to clean up the image I think..
Thanks
Terry
on August 10th, 2008 at 7:59 am
Oh.. your looking for the file named PHP.ini FIRST. You will find that line extension=php_gd2.dll in there..
And make SURE YOU TOUCH NOTHING ELSE!
And MAKE SURE YOU SAVE..
If your searching through the php.ini and you get to the SQL stuff youve gone too far! its between lines 600 and 800.
Good Luck!
Terry
on August 10th, 2008 at 10:13 am
Terry,
Thanks for that. I’m pretty certain that GD2 is enabled but I’ll check. I’ll have to ask the web host provider to enable it if it isn’t though. I’ll report back just for the sake of others who may have the same problem.
John
on August 10th, 2008 at 10:16 am
Just checked my phpinfo output and it says this. So I assume that GD2 is enabled then. Any further ideas anyone?
John
GD Support enabled
GD Version 2.0 or higher
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.2.1
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
on August 11th, 2008 at 2:04 am
Hi,
Firstly great script. I have installed in on my server no problem, however I have tried to install it on a 1and1.co.uk server and am getting the following, can anyone help?
1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘DEFAULT CHARSET=latin1 AUTO_INCREMENT=34′ at line 8
CREATE TABLE IF NOT EXISTS `gallery` ( `pict_id` int(5) NOT NULL auto_increment, `pict_name` varchar(100) NOT NULL, `pict_alt` varchar(100) NOT NULL, `pict_path` varchar(100) NOT NULL, `pict_thumb` varchar(100) NOT NULL, PRIMARY KEY (`pict_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=34 ;
[TEP STOP]
Thanks
Clark
on August 19th, 2008 at 2:16 am
Clark
Looks like they dont have a new enough version of Mysql. as the syntax changes with each version.
Hey badeziner,
You having any luck with this script? I know your doing this out of the kindness of your heart and all, im not very great at PHP yet, but, maybe if there is anythign I can do to help you? i dont care about money or anything, so its not about that. Its about learning to me.
The biggest thing I want to do with this is find a way to port it over to an SMF Forum. The only one they have for SMF is by a group of pretty slick programmers, but they want 50 bucks PER instance or install. thats nuts. I have 5 boards I host from my personal server.. thats 250 bucks!
The thing that sucks about thiers is it offers no lightbox integration whats-o-ever. And im not allowed to alter thiers according to the terms of use anyway.
Anyway, do you have any books you recommend or pointers you can give if you dont want me to try and help?
Im awesome at server stuff ya know, but not programming.. Though I wanna learn to make my own stuff.
on August 22nd, 2008 at 1:46 pm
Hallo, how can I put this script to my own pages? I have HTML page. Is it possible? Thanx for reply. It’s nice work!
on August 22nd, 2008 at 9:41 pm
If you have the skills you can put it on any website.
on August 26th, 2008 at 2:08 pm
Hallo badeziner, I have a question. I need new script with support categories. I think I make a new version. Don’t you have a new version? If no I have to make it. After I can upload this script for you if you want. Thank you for reply.
on September 23rd, 2008 at 12:31 am
Is anything happening with the update of this script? I’ve been waiting for months to see how it turned out.
Have you given up?
on September 23rd, 2008 at 12:56 am
Sorry for keeping you waiting. The new script is over 50% completed. My timetable is extremely loaded and I barely find time to work at the gallery, but I promise it’ll be out eventually.
on September 24th, 2008 at 6:18 am
Great work badeziner! Thanks for sharing this with everyone, cant wait for your new script!
on September 27th, 2008 at 11:32 am
That’s great to hear… wasn’t meaning to be pushy! Just very interested to see what you do with it.
on October 10th, 2008 at 7:01 pm
[...] it’s another gallery script with lightbox Free PHP Lightbox Photo Gallery Script | badeziner [...]
on October 20th, 2008 at 10:17 pm
[...] it’s another gallery script with lightbox Free PHP Lightbox Photo Gallery Script | badeziner [...]
on October 21st, 2008 at 5:05 pm
This script was just what I was looking for, only problem is the (enlarged) images doesn’t display as it should when using the Opera browser. (Part of the enlaged image is hidden). http://www.opera.com
on October 22nd, 2008 at 1:41 am
That’s strange. Could you send a screenshot? Thank you.
on October 24th, 2008 at 5:13 pm
it’s quickie and very very very successfulll. i am writeing a free-php-codes based cms and that will be there for image.
thx my friend.
on October 30th, 2008 at 9:36 am
i have a little problem with the script, i want to categorized the photo, like create diferents albums to fill them out with the photos that have have for diferent days for example, mayble you guys have update the version with this aplication that i need.
Thanks a lot
Jc
on November 15th, 2008 at 8:22 am
very nice. thanks a lot