Gallery software with thumbnail link

Soldato
Joined
6 Jan 2006
Posts
3,423
Location
Newcastle upon Tyne
I know there are loads of gallery software out there but what I need is one that will allow someone to copy the thumbnail and post it in a forum. Pretty much the way imageshack works but need it to be in house.

Many thanks.
 
Erm, not sure to be honest. I think I may have confused you when I said in house. I meant on my website (which is hosted for me) as apposed to using imageshack to upload the images to.
 
I know what your getting at here, sounds like you need a gallery that will generate suitable size thumbnails from the original? I too am also interested in suggestions here as looking for one myself

EDIT: Worth asking in photography as well due to the amount of people there with galleries/portfolios
 
Yes thats exactly what I want. Ive got 1000+ photos that I want people to beable to browse through then copy a thumbnail url and paste into a forum post.

Will see how it goes in here and if I dont get any joy I'll give the photography forum a shout thanks.
 
Thanks again, had a look through them all and none seem to provide a code to link page to that specific image sadly.
 
i've got an old php script knocking about i made for myself ages ago. i'll try and dig it out from my backups.

i'll be back. :p
 
ok, i've installed apache/php and am hosting my old script. you can test it here....

edit: linky removed. source a few posts down.

if that's any good to you let me know and i'll post the code up and tell you how to use it.

(no support for pages though - could be a problem with 1000 images. :eek: i guess it could be added though)
 
Last edited:
Marc, thats absolutely perfect! However is there anyway that it could be coded to stop anyone uploading an image? I can already see what would happen lol
 
Or could it even be possible just to upload the images to a directory? as uploading 1000 images is going to get teadious lol
 
hmmn, i'll have a dig around. i'm sure i've got a password protected version somehwere. :p

obviously you wouldn't upload the files manually. that would be madness. i'll try and add something to do it for you.
 
EDIT: example page removed but i've uploaded the source here.

http://cid-649d3bfeaf541fbb.skydrive.live.com/self.aspx/.Public/ocuk junk/upload.7z

it's now password protected. you can still browse the page if not logged in but can only delete/upload files if you are. open index.php in a text editor to set your own password (current password is ocuk :p).

you need to manually create 3 folders inside the same directory as you place the index.php file.

large
medium
small

you need to make sure php has write access to these folders. it displays the files in reverse date order so the the most recently uploaded files will show first. and that's about it really.

i still haven't done anything about processing the existing files. but you could batch process them using irfanview and placing the files into the folders manually. if you really want a php solution then give us a shout but i won't be able to do it until much later. :)
 
Last edited:
here's a quick and dirty resize script. follow the instructions above to setup the folder structure. now upload all your full size images into the LARGE folder only.

now save this as anything you like in the same folder as index.php and access it in a browser. :p

PHP:
<?php
define('LARGE', 'large/');
define('MEDIUM', 'medium/');
define('SMALL', 'small/');
$processed = 0;
$skipped = 0;
$errors = 0;
function resize($im, $destination, $width, $height, $max) {
	if($width > $max) {
		$ratio = $width / $height;
		$newwidth = $max;
		$newheight = $max / $ratio;
		$new = imagecreatetruecolor($newwidth, $newheight);
		imagecopyresampled($new, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
		imagejpeg($new, $destination);
		imagedestroy($new);
	} else {
		imagejpeg($im, $destination);
	}
}

$jpgfiles = glob(LARGE . '*.jpg');
foreach($jpgfiles as $file) {
	if(!file_exists(MEDIUM . basename($file))) {
		$im = imagecreatefromjpeg($file);
		if($im) {
			$width = imagesx($im);
			$height = imagesy($im);
			resize($im, MEDIUM . basename($file), $width, $height, 640);
			resize($im, SMALL . basename($file), $width, $height, 200);
			imagedestroy($im);
			$processed++;
		} else {
			$errors++;
		}
	} else {
		$skipped++;
	}
}
echo "$processed files processed.<br />$skipped files skipped.<br />unable to process $errors files.";
?>
 
Last edited:
Many thanks Marc, Im planning on getting the images online over the weekend so hopefully I can get everything working with your code.
 
Just tried to download your gallery script and it says the page cannot be found when I try to download it. Now it wont even let me get onto the page to download it.
 
that's odd. it's working here from 2 different browsers. it's a 7z file hosted on microsoft's skydrive service. :confused:

oh, and don't try and resize all your images at once (unless you want to fiddle about changing timeout settings. and it will hog the cpu too... :p)
 
Hmm maybe its my work netwrok settings. I'll try it at home tonight.

Will do thanks, I'll do them in batches
 
Back
Top Bottom