forum.coppermine-gallery.net

No Support => Feature requests => Topic started by: boii on January 20, 2005, 05:49:14 pm

Title: Conserve disk space option.
Post by: boii on January 20, 2005, 05:49:14 pm
it'd be great if coppermine had a feature to conserve disk space.
essentially right now coppermine takes an image, keeps the original size, and on top of it creates two more fiels (thumb+mid).
once you get a gallery with a lot of pictures, it starts to add up in disk space.

i use this gd resize on the fly script:

thumbnail.php
Code: [Select]
<?php
   define
(thumbnailWidth"158");
   
header("Content-type: image/jpeg");
   
$filename $HTTP_GET_VARS["filename"];     
   
$source imagecreatefromjpeg($filename); 
   
$thumbX thumbnailWidth;   
   
$imageX imagesx($source);
   
$imageY imagesy($source);   
   
$thumbY = (int)(($thumbX*$imageY) / $imageX );       
   
$dest  imagecreatetruecolor($thumbX$thumbY);
   
imagecopyresampled ($dest$source0000$thumbX$thumbY$imageX$imageY);       
   
imagejpeg($dest);
   
imagedestroy($dest);
   
imagedestroy($source);
?>

and then call images by thumbnail.php?filename=blah.jpg

essentially it only need the original. and on the fly resizes (creates, displays, destroys) and preserves ratio using the defined width (which you could pull from config).

anyone think it'd be a nice option in coppermine?


Title: Re: Conserve disk space option.
Post by: Nibbler on January 20, 2005, 06:28:26 pm
Ouch, poor server.
Title: Re: Conserve disk space option.
Post by: boii on January 20, 2005, 07:40:59 pm
Ouch, poor server.

yeah, it is a bit of a performance hit.
but it saves a buckload of disk space.

depends on yoru layout etc, its still feasible.
Title: Re: Conserve disk space option.
Post by: kegobeer on January 20, 2005, 10:06:33 pm
1.4 has a config switch that automatically resizes images that are larger than the max allowed.
Title: Re: Conserve disk space option.
Post by: Hein Traag on January 21, 2005, 09:10:55 am
hehe i think the owner of the server where i host my gallery would not be pleased if i used this. But then again unlimited space does not need such a script. Could be usefull for people with small amounts of webspace but it does create higher stresslevels for any server.
Title: Re: Conserve disk space option.
Post by: Joachim Müller on January 21, 2005, 03:33:45 pm
thumbnails don't eat that much space - it's the full sized pics that are hardly ever viewed on most setups that eat up most webspace, so the "on the fly" resize kegobeer was refering to will be a big plus.
Webhosts would hate us if we applied your hack to the core code, and would even ban coppermine from their servers, so I suggest you post your mod (with more details how to apply it for newbies) here and we'll move it to the mods section, along with a warning that this script can have a severe impact on the server performance.

Joachim