Jump to content

Php Photo Gallery


jwilk
 Share

Recommended Posts

  • 1 month later...
Has anyone worked with have a cool php or other program to create a photo gallery.

 

How fancy do you want it?

I have a simple CGI script I wrote for my gallery.

 

Edit: DOh!

 

http://www.thehomeforums.com/cgi-bin/pendragon.cgi

 

I've got some editing to do on it, now that it has so many pictures in it, mostly cosmetic.

Edited by Pendragon
Link to comment
Share on other sites

  • 2 weeks later...

After using Web Album Generator for sometime I decided I needed a change. WAG, is pretty simple to use except it generates "HTML" pages that I would need to change to get it to do what I wanted. Plus, adding a picture to an existing album was a pain that needed me to edit a number of "HTML" pages.

 

So just in time for my latest update to my photo gallery, I found this thread. I tried three of the "programs" mentioned; Coppermine, Gallery & SPGM. After trying them all, SPGM is the one for me. Here are some of my reasons.

 

Coppermine: Seemed way to powerful for what I needed. It also seems to be sluggish at times and a little to ridged. I have several "albums" on a few sub-domains, and I felt it would take me multiple copies and forever to get it working the way I wanted it to.

 

Gallery: I admit it, I couldn't figure out how to get it installed and gave up.

 

SPGM: I love this one. In less then the time it took me to get Coppermine configured, I had a photo album on-line with SPGM. After you get SPGM uploaded, all you need to do is create a directory with your pictures and their thumbnails in the "gal" directory (BTW, this can be changed) and you have a photo album. To add a picture, just put it and the thumbnail into the album's directory and it is added to album. It is also highly customizable and can be reformatted to fit my needs. As an added bonus, I was also able to get into to work with my sub-domains and multiple photo albums will not be a problem. All I need to do is have copies of the basic setup files on each sub-domain and only have the "brains" installed once.

 

Like jnull, the author of SPGM will be getting a donation from me real soon.

 

When I am finihsed making my changes, I post a link to my new photo albums.

Link to comment
Share on other sites

  • 1 month later...
I believe its this that you are looking for.  :)

 

But I think there is a readme file included too.

 

Thanks. The installation does not look as easy as I would hope. And, I noticed jhollin1138's comment that "I admit it; I couldn't figure out how to get it installed and gave up." I will dig into this deeper and see how it goes.

Link to comment
Share on other sites

I really like JAlbum. I'm totally new at this. I've tried SPGM and Coppermine but I really like this. It's very easy to use with some great template options. I think there is one that supports web uploads but most are like SPGM where you design your gallery then upload it to your server.

Link to comment
Share on other sites

...I think there is one that supports web uploads but most are like SPGM where you design your gallery then upload it to your server.

You don't need to create a gallery to use SPGM. All you really need to do is copy your pictures and thumbnails to a folder, and it generates the gallery.

 

You can, if you like, name your gallery using a text file called "gal-desc.txt" that contains your gallery title. Also, yo can caption your pictures/thumbnails using another text file called "pic-desc.txt" (in the case of SPGM-Vid, it should be called "vid-desc.txt"). Neither are required to actually generate the gallery.

Link to comment
Share on other sites

  • 1 month later...

Does anyone happen to have a function using GD to create thumbnails while maintaining their proportions and padded to a fixed resolution? Any of the above opensource scripts happen to do that?

Edited by section31
Link to comment
Share on other sites

Does anyone happen to have a function using GD to create thumbnails while maintaining their proportions and padded to a fixed resolution?  Any of the above opensource scripts happen to do that?

 

Ok, I figured it out. In case anybody wants to use it someday.

><?
//  Makes thumbnails to a fixed size and uses padding to keep aspect ratio.
//  email section31 at gmail to report bugs or improvements.  :)
function makeThumb($file)
{
$dstWidth = 80;
$dstHeight = 120;
list(, , $type, ) = getimagesize($file);
//1 = GIF, 2 = JPG, 3 = PNG   
if ($type == 2)
 $handle = @imagecreatefromjpeg($file);
elseif ($type == 3)
 $handle = @imagecreatefrompng($file);
elseif ($type == 1)
 $handle = @imagecreatefromgif($file);
elseif (!$handle)
 return false;
else
 return false;

$srcWidth  = @imagesx($handle);
$srcHeight = @imagesy($handle);

if ($srcWidth >= $dstWidth && $srcHeight >= $dstHeight) {
 $newHandle = @imagecreatetruecolor($dstWidth, $dstHeight);

 if ($srcWidth/$srcHeight > $dstWidth / $dstHeight) {
	 $thumbwidth = $dstWidth;
	 $thumbheight = round( ($thumbwidth / $srcWidth) * $srcHeight );
	 $xOffset = 0;
	 $yOffset = round(($dstHeight - $thumbheight) / 2);
 }
 else {
	 $thumbheight = $dstHeight;
	 $thumbwidth = round( ($thumbheight / $srcHeight) * $srcWidth );
	 $xOffset = round(($dstWidth - $thumbwidth) / 2);
	 $yOffset = 0;
 }

 // Fill background with RGB Color ex. 255, 0, 0 equales RED
 $background = imageColorAllocate($newHandle, 0, 0, 0);
 imagefilledrectangle($newHandle, 0, 0, $dstWidth, $dstHeight, $background);
 
 if (!@imagecopyresampled($newHandle, $handle, $xOffset, $yOffset, 0, 0, $thumbwidth, $thumbheight, $srcWidth, $srcHeight))
	 return false;
 @imagedestroy($handle);
 
 if ($type == 3)
	 @imagepng($newHandle, $file);
 elseif ($type == 2)
	 @imagejpeg($newHandle, $file, 90);
 elseif ($type == 1)
	 @imagegif($newHandle, $file);
 else
	 return false;
 @imagedestroy($newHandle);
 return true;
}
else
 return false;
}
?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...