Member
Member
j916   2010-07-25, 00:55
#1
I just upgraded from 1.2x to 1.3 and before I start digging to see if I have a problem, I thought I'd ask the 's' parameter to i.php has changed. Before I upgraded, I had my thumb size set to 100 and my image size set to 640. If I accessed a picture like:

http://www.moto-treks.com/PhotoGallery/zp-core/i.php?a=South%20American%20Trip/Argentina&i=Argentina-0003.jpg&s=default

I would get an image with the size of 640. After the upgrade I would get an image the size of the thumb (100). I currently have the thumb size set to 640 so that all my reverences to my pictures remain as before.

My question; Does the s=default parameter do the same thing as the s=thumb parameter in 1.3?

As a side note, if you access the picture above you get the url

http://www.moto-treks.com/PhotoGallery/cache/South%20American%20Trip/Argentina/Argentina-0003_640_thumb.jpg

Note the 640_thumb.jpg name.
Administrator
Administrator
acrylian   2010-07-25, 08:24
#2
Actually `s` should be a numeric value, I really don't remember that it ever was "default" or "thumb" actually. I really don't think we have changed those parameters (but 1.2 is quite a while ago...). The parameters are explained in the comments at the beginning of the `i.php` file.

Of course some internal handling might have changed since but if you set up your theme correctly Zenphoto does all automatically.
Member
Member
j916   2010-07-26, 17:14
#3
I saved a copy of zenPhoto before the upgrade so I did a little investigation to see what happened. I found that in the 1.2.x version of i.php at line 63 the code looked like:

`

$args = array(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

if (isset($_GET['s'])) { //0

$args[0] = $_GET['s'];

}

`

the 1.3 version has changed to:

`

$args = array(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

if (isset($_GET['s'])) { //0

$args[0] = min(abs($_GET['s']), MAX_SIZE);

}

`

with the min function $args[0] would never contain 'default' which is used in the function getImageParameters

`

@list($size, $width, $height, $cw, $ch, $cx, $cy, $quality, $thumb, $crop, $thumbstandin, $WM, $adminrequest, $gray) = $args;

$thumb = $thumbstandin;

debugLog("functions-basic.php: \$size1=$size");

if ($size == 'thumb') {

$thumb = true;

if ($thumb_crop) {

$cw = $thumb_crop_width;

$ch = $thumb_crop_height;

}

$size = round($thumb_size);

} else {

if ($size == 'default') {

$size = $image_default_size;

debugLog("functions-basic.php: \$size=$size");

} else if (empty($size) || !is_numeric($size)) {

$size = false; // 0 isn't a valid size anyway, so this is OK.

} else {

$size = round($size);

}

}

`

I did a quick mode to i.php to check for 's' being numeric before calling min

`

$args = array(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

if (isset($_GET['s'])) { //0

if (is_numeric(abs($_GET['s']))) {

$args[0] = min(abs($_GET['s']), MAX_SIZE);

}

else {

$args[0] = $_GET['s'];

}

`

and zenphoto was back to working as before.

So, the question I have now is are the values of 'default' and 'thumb' going to be supported in the future for the parameters 's'? Or would I be better just setting 's' to a numeric value (I'll only need to change about 200 references LOL).

Is using i.php the the correct way to access photos in zenphoto from an external site assuming I don't want to access the original photo directly?
Member
Member
sbillard   2010-07-26, 17:28
#4
Your change looks correct. We will add it to the next release.
Member
Member
j916   2010-07-26, 18:01
#5
Then I'ld better post the correct code Wink for i.php (removed abs function when checking is_numeric)

`

if (isset($_GET['s'])) { //0

if (is_numeric($_GET['s'])) {

$args[0] = min(abs($_GET['s']), MAX_SIZE);

}

else {

$args[0] = $_GET['s'];

}

}

`
Member
Member
sbillard   2010-07-26, 19:02
#6
Well, fortunately I did not carefully read the code you posted, so I actually made the correct correctionSmile
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.