Nurv-OS

...because your system matters to you

  • Increase font size
  • Default font size
  • Decrease font size

Lightbox + PHPGD = Simple Solution

User Rating: / 508
PoorBest 

Lightbox + PHPGD = Simple Soultion

  Provided by sister company Synapsesinc.com

Are you tired of "PHP Galleries" that are "easy" to install, only to leave you with two copies of the image on your server, or requiring you to make a thumbnail image of the picture that can be time consuming and quite litterally a pain. What if, depending on your server of course, could drop images into a folder, and poof, your done. If you have a PHP and GD compliamt webserver, and you want a cool lightbox image gallery, that is easy to update and maintain with the use of ftp, download the latest Synapse Lightbox. Take a peek at the source below. Click here to see it in action and download here

Code Sample (XHTML/CSS)

Type the following code then press Ctrl+S to save the document.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
Synapses Inc. Auto Resize Lightbox Gallery
</title>
<!-- Meta Tags -->
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, follow" />
<!-- CSS -->
<link rel="stylesheet" href="staticfiles/css/lightbox.css" type="text/css" media="screen" />
<link rel="stylesheet" href="staticfiles/css/default.css" type="text/css" media="screen" />
<!-- Javascripts -->
<script src="staticfiles/code/scripts/prototype.js" type="text/javascript"></script>
<script src="staticfiles/code/scripts/scriptaculous.js?load=effects" type="text/javascript"></script>
<script src="staticfiles/code/scripts/lightbox.js" type="text/javascript"></script>
</head>
<body>
<div id="container">
    <center><h3>Synapses Inc. Auto Resize Lightbox Gallery</h3></center>
    <p>&nbsp;</p>
    <ul>
        <table align="center" width="600px">
            <tr>
<?
    
// Gallery Directory
    
$imgdir = 'gallery/';
    
//Standard Open Directory Call
    
$dir = opendir($imgdir) or die("Cannot open directory :" . $imgdir);
    
//Standard Counter
    
$cntr = 1;
    
//How many Colums would you like in the display
    
$cols = "4";
    
//Now we set a standard width in pixels
    
$standard_width = "90";
    
//Now time for the work to get done
    
while($file = readdir($dir))  // reading the dir
    
{
        if(
$file <> '.' && $file <> '..')
        {
            
$ext = substr($file, -3);
            if(
strtolower($ext) == "jpg") {
                
$size = getimagesize($imgdir ."" . $file);
                if(
$size[0] > $standard_width){ //We will now need to resize the image propely
                    
$calc = $standard_width / $size[0];
                    
$percentage = number_format($calc, 2);
                     
$w =  $percentage * $size[0];
                    
$h =  $percentage * $size[1];
                } else {
                    
$w =  $size[0];
                    
$h =  $size[1];
                }
                if(
$cntr < $cols) {
                    echo
"<td><a href='". $imgdir ."". $file . "' rel='lightbox[gallery]'><img border='0' src='staticfiles/code/imgsize.php?w=". $w ."&h=". $h ."&img=". $imgdir ."". $file ."' /></a><td>";
                    
$cntr++;
                } else {
                    echo
"<td><a href='". $imgdir ."". $file ."' rel='lightbox[gallery]'><img border='0' src='staticfiles/code/imgsize.php?w=". $w ."&h=". $h ."&img=". $imgdir ."". $file ."' /></a><td></tr><tr>";
                    if(
$cntr == $cols) {
                        
$cntr = 0;
                    }
                    
$cntr++;
                }                    
            }
        }
    }
?>
        </tr>
    </table>
    <table align="center" width="600px">
            <tr>
                <td>If you like the scripts, <a href="lightbox.zip">here</a> is a zip copy of the source.  Enjoy!<br />
                If you use the scripts shoot us an email at This e-mail address is being protected from spambots. You need JavaScript enabled to view it .
                </td>
            </tr>
    </table>
  </ul>
</div>
<!--container-->
</body>
</html>


Comments

You must javascript enabled to use this form

There are no comments yet. Feel free to add one using the form below.

Add comments: Lightbox + PHPGD = Simple Solution

Enter your comment below:

(required)

(required)

Your email will not be displayed on the site; only to our administrator.

(optional)

For more BBCode info:  [Click here]

Supported BBCode

[b]bolded text[/b]
[i]italicized text[/i]
[u]underlined text[/u]
[s]striked text[/s]
[sub]subscripts text[/sub]
[sup]superscripts text[/sup]
[center]center text[/center]
[hr] To draw a line
[url]http://ongetc.com[/url]
To quote:[quote]quoted text[/quote]
[code]monospaced text[/code]
To change text size: [size=9]Your Text[/size]
To change text color: [color=red]Red Text[/color]
or [color=#FF0000]Red Text[/color]
(Can use many different color names or hex codes.)




Last Updated on Monday, 27 April 2009 23:49  
Donate using PayPal
Amount:
Note:

Statistics

Content View Hits : 267777

Latest Comments


Software Box

Enchanted Forest - Animated Screensaver
In the amazing, fabulous forest among the lofty trees live fabulous creatures - bright butterflies, little luminous fairies and snow-white unicorn.

Spherical Panorama Fisheye Stitcher
Utility for create spherical panorama logotype. Gaussian and Sharpen correction of seam.

The Washington Memorial - Animated Wallpaper
This is an Animated Wallpaper of "The Washington Memorial" with music.

dvdXsoft DVD to Zune Converter
This program can convert video DVD to MP4 Video files suitable for Zune. Watch your favorite movies mobile.

Picture Viewer and Converter Suite
Easy to use imaging software for viewing and converting your digital photos.

Magic Lines
It is a cute little of the beloved Lines. You have the square game board where you should move multicolored balls to make lines of five balls that match in color.

ID_Bank
This is a secure Identity and password manager. It is able to hold your personal information relating to usernames, passwords, pins, login details etc.

MING Chat Monitor
Monitor and record AOL, MSN, Yahoo, and ICQ conversations on your LAN in stealth mode.

Rename From List
Automatically rename multiple files from an imported plain text list of files or create new folders from a plain text folder list.

SoftX HTTP Debugger
It is a full-scale tool for intercepting, viewing and analyzing the HTTP traffic between a web browser or any program that uses the HTTP protocol, and the web server.

Escaping Atlantis
Help Oceana escape Atlantis, using your puzzling skills to collect gems.

Allok MPEG4 Converter
This is a powerful and handy video converter which helps you convert all popular video / movie to MPEG4 format.

Privacy Guard
Erase your Internet tracks, computer activities, and history. Your secrets are safe with Privacy Guard.

Nevo Audio Splitter
It is a powerful and ease-to-use audio splitter. It can split mp3 and wma files.

Pokie Magic Maidens Treasure
It is an Aussie style 20 payline 5 reel poker machine (also called a slot machine or a "Pokie").

Okoker CD&DVD Burner
This software is easy in use, burns CDs, DVDs and disc images without any problems, works fast and uses low resources.

Jesterware PSP Video Suite
It is a professional video converter for Sony PSP consoles. You can easily and quickly convert videos in all popular formats to Sony PSP compliant video files.

Audio Mid Recorder
This is a powerful real-time sound recorder. It is designed to work directly with your sound card, so it can record almost all audio from your sound card at near-perfect quality what you can hear f...

Binary Boy
A yEnc and NZB compliant newsreader with cache and scheduler. Download music, pictures, and movies from newsgroups quickly and conveniently.

ArchiCrypt Shredder
It is data shredder and trace destroyer. It deletes sensitive data so completely that it is impossible to reconstruct it using special software.