Welcome to WebmasterWorld Guest from 54.158.228.55

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Looking for a simple gallery script

No gimmicks needed

     
1:05 pm on Jun 23, 2008 (gmt 0)

10+ Year Member



Can anyone give me a recommendation for a simple gallery script that allows to easily include a gallery into an existing web design without having to make modifications to thousands of files? I don't need any features like "Most frequently viewed photos" or "Recently uploaded photos", just something that allows to set up different categories and pops up the large versions of the photos when clicking on a thumbnail.
Thanks!
2:25 pm on Jun 23, 2008 (gmt 0)

5+ Year Member



try: [gallery.menalto.com...]

does much more than want, gallery2 does have a template system which should make for quick integration.

2:50 pm on Jun 23, 2008 (gmt 0)

10+ Year Member



Thanks, mrscruff. I'm using it on some other sites but for this specific project it's far too advanced.
9:34 pm on Jul 22, 2008 (gmt 0)

10+ Year Member



this may hep you
[zenphoto.org...]
9:58 pm on Jul 22, 2008 (gmt 0)

WebmasterWorld Senior Member henry0 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



We tend to write our own scripts, give that one a try
you may for sure edit and modify it.
it should give you a good start.

From WebmasterWorld library
Image upload and Thumbnail Generator
CREDIT TO: BIRDMAN

This script works with a MySQL database that contains info for the pics. You need to create a table named pics.

CREATE TABLE `pics` (
`pid_id` VARCHAR NOT NULL ,
`pic_name` VARCHAR( 150 ) ,
`descrip` TEXT,
PRIMARY KEY ( `pid_id` )
)

The Form

<form enctype="multipart/form-data" action="loademup.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="300000">
<input name="userfile[]" type="file" /><br />
<input name="userfile[]" type="file" /><br />
<input name="userfile[]" type="file" /><br />
<input name="userfile[]" type="file" /><br />
<input name="userfile[]" type="file" /><br />
<input name="userfile[]" type="file" /><br />
<input type="submit" />
</form>

loademup.php

<html>
<head><title>Enter Name and Descriptions of Pics</title></head>
<body>
<h1>Enter Name and Descriptions of Pics</h1>
<form action="view.php" method="post">
<?php
$dbh=mysql_connect("localhost", "username", "password") or die ('I cannot connect to the database.');
mysql_select_db("db");

$uploaddir = '/home/username/public_html/images/';
$tot = count($userfile);
$num = 0;
for($q=0;$q<$tot;$q++){

if ($_FILES['userfile']['name'][$q] == "") continue;
$num = $num + 1;
$sql = "SELECT pic_id FROM pics ORDER BY pic_id DESC LIMIT 1";
$result = mysql_query($sql);

while($i = mysql_fetch_array($result)){
$new_id = $i['pic_id'] + 1;
$new_pic = "$new_id.jpg";
}

if (move_uploaded_file($_FILES['userfile']['tmp_name'][$q], $uploaddir . $new_pic)) {
$sql = "INSERT INTO `pics` ( `pic_id` , `name` , `descrip` )VALUES ('$new_id', NULL , NULL);";
mysql_query($sql);
} else {
print "<strong>$_FILES['userfile']['name'][$q]</strong> did not upload!";
}

$new_thumb = "thumbs/$new_pic";
$sourcefile = "$uploaddir$new_pic";
$picsize = getimagesize("$sourcefile");
$source_x = $picsize[0];
$source_y = $picsize;

if ($source_x > $source_y){
$dest_x = 200;
$dest_y = 150;
} else {
$dest_x = 150;
$dest_y = 200;
}

$targetfile = "$uploaddir$new_thumb";
$jpegqual = 75;
$source_id = imagecreatefromjpeg("$sourcefile");
$target_id = imagecreatetruecolor($dest_x, $dest_y);
$target_pic = imagecopyresized($target_id,$source_id,0,0,0,0,$dest_x,$dest_y,$source_x,$source_y);
imagejpeg($target_id,"$targetfile",$jpegqual);
?>
<div style="clear: both;">
<a href="/images/<?=$new_pic?>">
<img src="/images/<?=$new_thumb?>" style="float: left" />
</a>
<strong><?=$_FILES['userfile']['name'][$q]?></strong><br /><br />
<strong>Name:</strong><br />
<input type="text" name="pic_name[<?=$num?>]" /><br /><br />
<strong>Description:</strong><br />
<textarea name="descrip[<?=$num?>]"></textarea>
<input type="hidden" name="pic_id[<?=$num?>]" value="<?=$new_id?>" />
</div>
<?php
}
?>
<input type="submit" value="Click to Save Descriptions" />
</form>
</body>
</html>


view.php

<html>
<head><title>View Pics and Descriptions</title></head>
<body>
<h1>View Pics and Descriptions</h1>
<?php
$dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database.');
mysql_select_db ("db");$num = 0;
$tot = count($pic_id);

for ($q=0;$q<$tot;$q++){
$num = $num + 1;
$sql = "UPDATE pics SET descrip = '$descrip' , name = '$pic_name' WHERE pic_id = $pic_id[$num]";
mysql_query($sql);
?>
<div style="clear: both;">
<a href="/images/<?php echo "$pic_id[$num].jpg"?>">
<img src="/images/thumbs/<?php echo "$pic_id[$num].jpg"?>" style="float: left" />
</a>
<h2><?=$pic_name[$num]?></h2>
<p><?=$descrip[$num]?></p>
</div>
<?php
}
mysql_close();
?>
</body>
</html>

10:07 pm on Jul 22, 2008 (gmt 0)

10+ Year Member



Thanks a lot, that look interesting - will try it!
 

Featured Threads

Hot Threads This Week

Hot Threads This Month