Conserve disk space option. Conserve disk space option.
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

Conserve disk space option.

Started by boii, January 20, 2005, 05:49:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

boii

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

<?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?



Nibbler


boii

Quote from: Nibbler on January 20, 2005, 06:28:26 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.

kegobeer

1.4 has a config switch that automatically resizes images that are larger than the max allowed.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

Hein Traag

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.

Joachim Müller

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