Welcome Guest, Not a member yet? Register   Sign In
image_lib bug?
#1

[eluser]davdtm[/eluser]
Hi everybody, I'm trying to exploit the image_lib tools to rescale twice an image got from an upload. My final goal is rescale the original image (of arbitrary size) once it's available after uploading, to a standard "big" size and a standard "small" (meaning thumbnail) size, getting two final images from one. For this, once got the image from the upload I run resize() a first time passing suitable values for the following parameters:

'source_image'=>'/path...',
'new_image'=>'/path...',
'create_thumb' => TRUE,
'width'=>$width_thumbnail,
'height'=>$height_thumbnail

This generates a new thumbnailed image, as desired. Then I clean up the parameters with:

$this->image_lib->clear()

and I re-run resize() passing:

'source_image'=>'/path...',
'width'=>$width_large_image,
'height'=>$height_large_image

missing the 'create_thumb' and 'new_image' parameters I thought I should have had a rescaling applied to the original image. However I saw it was not true, because $this->image_lib->clear() does not reset 'create_thumb'. In fact, forcing 'create_thumb' to FALSE in this second parameters set, I got the desired result.

First question: do you think this is a bug? I would say yes, I don't see any reason to clean all the variables but 'create_thumb'.

Second question: Don't you think it might be very useful to add another function, say $this->image_lib->reset(), which restores the default values of all variables? Because clear does not restore the defaults, but just sets all the values to empty strings.

Thanks

Davide


Messages In This Thread
image_lib bug? - by El Forum - 02-24-2011, 04:16 AM
image_lib bug? - by El Forum - 03-10-2011, 11:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB