rifanece / timthumb

Automatically exported from code.google.com/p/timthumb
0 stars 0 forks source link

Constants not properly decleared. #43

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. if php.ini contains the following line: error_reporting  =  E_ALL
2. And code in timtumb contains:
$imageFilters = array(
    "1" => array(IMG_FILTER_NEGATE, 0),
    "2" => array(IMG_FILTER_GRAYSCALE, 0),
    "3" => array(IMG_FILTER_BRIGHTNESS, 1),
    "4" => array(IMG_FILTER_CONTRAST, 1),
    "5" => array(IMG_FILTER_COLORIZE, 4),
    "6" => array(IMG_FILTER_EDGEDETECT, 0),
    "7" => array(IMG_FILTER_EMBOSS, 0),
    "8" => array(IMG_FILTER_GAUSSIAN_BLUR, 0),
    "9" => array(IMG_FILTER_SELECTIVE_BLUR, 0),
    "10" => array(IMG_FILTER_MEAN_REMOVAL, 0),
    "11" => array(IMG_FILTER_SMOOTH, 0),
);
3.

What is the expected output? What do you see instead?
 Error message: otice: Use of undefined constant IMG_FILTER_NEGATE -
assumed 'IMG_FILTER_NEGATE' in
/home/domains/www.imm-award.de/htdocs/wp-content/themes/constructor/timthumb.php
on line 30

Notice: Use of undefined constant IMG_FILTER_GRAYSCALE - assumed
'IMG_FILTER_GRAYSCALE' in
/home/domains/www.imm-award.de/htdocs/wp-content/themes/constructor/timthumb.php
on line 31

Notice: Use of undefined constant IMG_FILTER_BRIGHTNESS - assumed
'IMG_FILTER_BRIGHTNESS' in
/home/domains/www.imm-award.de/htdocs/wp-content/themes/constructor/timthumb.php
on line 32

Notice: Use of undefined constant IMG_FILTER_CONTRAST - assumed
'IMG_FILTER_CONTRAST' in
/home/domains/www.imm-award.de/htdocs/wp-content/themes/constructor/timthumb.php
on line 33

Notice: Use of undefined constant IMG_FILTER_COLORIZE - assumed
'IMG_FILTER_COLORIZE' in
/home/domains/www.imm-award.de/htdocs/wp-content/themes/constructor/timthumb.php
on line 34

And so on...

What version of the product are you using? On what operating system?

Timthumb version 1.09

Please provide any additional information below.

Please note that constant name must always be quoted when defined.

e.g.
define('MY_CONST','blah') - correct
define(MY_CONST,'blah') - incorrect

The error message above also indicates this fact.

If this code is used instead in the script:
$imageFilters = array(
    "1" => array('IMG_FILTER_NEGATE', 0),
    "2" => array('IMG_FILTER_GRAYSCALE', 0),
    "3" => array('IMG_FILTER_BRIGHTNESS', 1),
    "4" => array('IMG_FILTER_CONTRAST', 1),
    "5" => array('IMG_FILTER_COLORIZE', 4),
    "6" => array('IMG_FILTER_EDGEDETECT', 0),
    "7" => array('IMG_FILTER_EMBOSS', 0),
    "8" => array('IMG_FILTER_GAUSSIAN_BLUR', 0),
    "9" => array('IMG_FILTER_SELECTIVE_BLUR', 0),
    "10" => array('IMG_FILTER_MEAN_REMOVAL', 0),
    "11" => array('IMG_FILTER_SMOOTH', 0),
);

everything works fine. Please update your script.

Original issue reported on code.google.com by jorgen.i...@gmail.com on 4 Nov 2009 at 1:08

GoogleCodeExporter commented 8 years ago
these constants are part of the GD library (as detailed here:
http://uk3.php.net/imagefilter) so shouldn't need to be included. Instead I am
checking if the constant is defined and skipping the required code if it isn't.
Hopefully that works ok

Original comment by BinaryMoon on 31 Dec 2009 at 5:10