Select the resolution of the image to download

jvaiguade

Joined: 2006-06-12
Posts: 13
Posted: Wed, 2006-08-16 12:30

Hello,

i have 10 images in gallery 2.

All images have the next resolutions: 1024x768, 800x600, 600x400.

I need to download in a zip the images in a different resolutions.

It's possible?

Thnks

Gallery version (not just "2"):2.1.1
PHP version (e.g. 4.3.11):5.0.5 isapi
Webserver (e.g. Apache 1.3.33):Microsoft-IIS/5.0
Database (e.g. MySql 4.0.11):mysql 4.1.18-nt, lock.system=database
Activated toolkits (e.g. NetPbm, GD):NetPbm, GD, ImageMagick
Operating system (e.g. Linux):WIN 2000 Server
Browser (e.g. Firefox 1.0):1.5.0.6

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2006-08-16 16:15

no, the zip cart module always selects the largest size you have permission to view.
you'd have to modify modules/zipcart/classes/ZipCartPlugin.class to select a specific size.

 
jvaiguade

Joined: 2006-06-12
Posts: 13
Posted: Thu, 2006-08-17 10:15

very much thanks mindless i go to look that class bye ;)

I think this is the code:

		foreach ($resizes[$itemId] as $resize) {
		    $size = $resize->getDerivativeSize();
		    if (!isset($maxSize) || $size > $maxSize) {
			$item = $resize;
			$maxSize = $size;
		    }
		}

but for do that i think its necessary to add a new col or field in viewcart.tpl "Size" because i can select the same image in different sizes and this is 2 lines in viewcart.tpl.

Its possible? or very hard?

 
jvaiguade

Joined: 2006-06-12
Posts: 13
Posted: Thu, 2006-08-17 10:16

I think i need add a field "size" on the cart.

Where G2 store the information of the Cart? Can i add a field?

After (in viewcart.tpl) show that in a column.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2006-08-21 15:30

you'll have to modify the cart module, but you can do that...

 
aqueront
aqueront's picture

Joined: 2006-08-23
Posts: 5
Posted: Wed, 2006-08-23 07:41

I also need it, i watched for the cart module and i dont know how to pick up the size

 
siemens

Joined: 2006-08-23
Posts: 2
Posted: Wed, 2006-08-23 07:51

Hi i also need for a important project

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2006-08-23 14:32

http://gallery.menalto.com/sfvote/all -- if you don't see this request listed there, you can file a request on sf.net and then vote for it in sfvote once it syncs over (~half a day).

 
siemens

Joined: 2006-08-23
Posts: 2
Posted: Thu, 2006-08-24 07:54

ok do

 
aqueront
aqueront's picture

Joined: 2006-08-23
Posts: 5
Posted: Fri, 2006-08-25 08:43

i think,in this source it's possible render image witdh function render of galleryDerivativeImage.class?

foreach ($resizes[$itemId] as $resize) {
$size = $resize->getDerivativeSize();
if (!isset($maxSize) || $size > $maxSize) {
$item = $resize;
$maxSize = $size;
}
}

what do you think this?

 
aqueront
aqueront's picture

Joined: 2006-08-23
Posts: 5
Posted: Fri, 2006-08-25 11:51

how i do this?

 
aqueront
aqueront's picture

Joined: 2006-08-23
Posts: 5
Posted: Mon, 2006-08-28 08:22

i can resize image width this:

$anchura=800;
$hmax=600;

copy($ruta,$nombre);
$archivoCop=basename($nombre);
$archivoCop="pp_".$archivoCop;
$datos = getimagesize($nombre);
if($datos[2]==1){$img = @imagecreatefromgif($nombre);}
if($datos[2]==2){$img = @imagecreatefromjpeg($nombre);}
if($datos[2]==3){$img = @imagecreatefrompng($nombre);}
$ratio = ($datos[0] / $anchura);
$altura = ($datos[1] / $ratio);
if($altura>$hmax){$anchura2=$hmax*$anchura/$altura;$altura=$hmax;$anchura=$anchura2;}
$thumb = imagecreatetruecolor($anchura,$altura);
imagecopyresampled($thumb, $img, 0, 0, 0, 0, $anchura, $altura, $datos[0], $datos[1]);
if($datos[2]==1){header("Content-type: image/gif"); imagegif($thumb,$camino[0]."tmp/".$archivoCop);}
if($datos[2]==2){header("Content-type: image/jpeg");imagejpeg($thumb,$camino[0]."tmp/".$archivoCop);}
if($datos[2]==3){header("Content-type: image/png");imagepng($thumb,$camino[0]."tmp/".$archivoCop); }
copy($camino[0]."tmp/".$archivoCop,$original);
unlink($camino[0]."tmp/".$archivoCop);
unlink($nombre);

 
aqueront
aqueront's picture

Joined: 2006-08-23
Posts: 5
Posted: Tue, 2006-08-29 07:07

i put this in the zipcart.class i need send the size to the cart and send the cart from a zipcart