Member
Member
Ballwalker   2006-01-21, 21:13
#1

Sometimes in a theme, it becomes necessary to have both a max width [b]and[/b] max height with different variables. Zenphoto doesn't currently allow that, But I modified the script to do just that. (Please excuse the hack-ish nature of this, I'm not a very good php guy):

In config.php, change lines 60 - 63 from:
`

$conf['image_size'] = 595;

// If this is set to true, then the longest side of the image will be $image_size.

// Otherwise, the width of the image will be $image_size.

$conf['image_use_longest_side'] = true;

`

to:

`

$conf['width_image_size'] = 595;

// set this to the maximum height you want an image to be

//

$conf['height_image_size'] = 500;

`

and in i.php, change line 13 from:

`

$image_use_longest_side = zp_conf('image_use_longest_side');

`

to:

`

$height_image_size = zp_conf('height_image_size');

`

and lines 68 -75 from:

`

    } else {

      if ($image_use_longest_side && $h > $w) {

    $newh = $size;

    $neww = round(($w / $h) * $size);

  } else {

        $neww = $size;

        $newh = round(($h / $w) * $size);

  }

`

to:

`

    } else {

        $tempw = $size;

        $temph = round(($h / $w) * $size);

if ($temph > $height_image_size) {

        $newh = $height_image_size;

        $neww = round(($tempw / $temph) * $height_image_size);

} else {

$newh=$temph;

$neww=$tempw;

}

`

it works, but I'm sure someone can make the code look a little more pretty ;-)

Developer
Developer
trisweb   2006-01-21, 23:56
#2

We should be able to integrate that functionality into the base release. Looks pretty useful. Thanks for the idea!

Member
Member
kevito   2006-06-23, 17:32
#3

This doesn't work in Zenphoto 1.0.3. Could anyone help me get this same result with the new code? Thanks!

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.