Welcome Guest, Not a member yet? Register   Sign In
error_msg within image_lib not resetting on clear()
#1

[eluser]Unknown[/eluser]
I was running a ->resize() on an uploaded image within a loop to generate a handful of newly sized images. What I found when an error was created was that the error messages were continually being concatenated to error_msg on each iteration of the loop (which I guess is normal) but the variable wasn't being reset when calling ->clear().

Loop iteration 1
Unable to save the image. Please make sure the image and file directory are writable.

Loop iteration 2
Unable to save the image. Please make sure the image and file directory are writable.
Unable to save the image. Please make sure the image and file directory are writable.

Loop iteration 3
Unable to save the image. Please make sure the image and file directory are writable.
Unable to save the image. Please make sure the image and file directory are writable.
Unable to save the image. Please make sure the image and file directory are writable.

etc

To satisfy my needs, I've simply added error_msg to the clear() function within image_lib but wonder why this isn't done as standard practice? Maybe I'll add it as an argument of the clear() function - reset standard variables or *all* variables.




Theme © iAndrew 2016 - Forum software by © MyBB