@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | { |
142 | 142 | // JPEG output that does not require cjpeg added by James Heinrich <[email protected]> - December 10, 2003 |
143 | 143 | if (('WIN' !== strtoupper(substr(PHP_OS, 0, 3))) && (file_exists('/usr/local/bin/cjpeg') || shell_exec('which cjpeg'))) { |
144 | - if (gif_outputAsBmp($gif, $lpszFileName . '.bmp', $bgColor)) { |
|
145 | - exec('cjpeg ' . $lpszFileName . '.bmp >' . $lpszFileName . ' 2>/dev/null'); |
|
146 | - @unlink($lpszFileName . '.bmp'); |
|
144 | + if (gif_outputAsBmp($gif, $lpszFileName.'.bmp', $bgColor)) { |
|
145 | + exec('cjpeg '.$lpszFileName.'.bmp >'.$lpszFileName.' 2>/dev/null'); |
|
146 | + @unlink($lpszFileName.'.bmp'); |
|
147 | 147 | |
148 | 148 | if (@file_exists($lpszFileName)) { |
149 | 149 | if (@filesize($lpszFileName) > 0) { |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | $ret = ''; |
501 | 501 | |
502 | 502 | for ($i = 0; $i < $this->m_nColors; $i++) { |
503 | - $ret .= chr($this->m_arColors[$i] & 0x000000FF) . // R |
|
504 | - chr(($this->m_arColors[$i] & 0x0000FF00) >> 8) . // G |
|
505 | - chr(($this->m_arColors[$i] & 0x00FF0000) >> 16); // B |
|
503 | + $ret .= chr($this->m_arColors[$i] & 0x000000FF).// R |
|
504 | + chr(($this->m_arColors[$i] & 0x0000FF00) >> 8).// G |
|
505 | + chr(($this->m_arColors[$i] & 0x00FF0000) >> 16); // B |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | return $ret; |
@@ -518,9 +518,9 @@ discard block |
||
518 | 518 | $ret = ''; |
519 | 519 | |
520 | 520 | for ($i = 0; $i < $this->m_nColors; $i++) { |
521 | - $ret .= chr(($this->m_arColors[$i] & 0x00FF0000) >> 16) . // B |
|
522 | - chr(($this->m_arColors[$i] & 0x0000FF00) >> 8) . // G |
|
523 | - chr($this->m_arColors[$i] & 0x000000FF) . // R |
|
521 | + $ret .= chr(($this->m_arColors[$i] & 0x00FF0000) >> 16).// B |
|
522 | + chr(($this->m_arColors[$i] & 0x0000FF00) >> 8).// G |
|
523 | + chr($this->m_arColors[$i] & 0x000000FF).// R |
|
524 | 524 | "\x00"; |
525 | 525 | } |
526 | 526 | |
@@ -791,14 +791,14 @@ discard block |
||
791 | 791 | if (!$this->m_gih->load($data, $len = 0)) { |
792 | 792 | return false; |
793 | 793 | } |
794 | - $data = substr($data, $len); |
|
794 | + $data = substr($data, $len); |
|
795 | 795 | $datLen += $len; |
796 | 796 | |
797 | 797 | // ALLOC BUFFER |
798 | 798 | if (!($this->m_data = $this->m_lzw->deCompress($data, $len = 0))) { |
799 | 799 | return false; |
800 | 800 | } |
801 | - $data = substr($data, $len); |
|
801 | + $data = substr($data, $len); |
|
802 | 802 | $datLen += $len; |
803 | 803 | |
804 | 804 | if ($this->m_gih->m_bInterlace) { |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | $lne = substr($this->m_data, 0, $this->m_gih->m_nWidth); |
914 | 914 | $this->m_data = substr($this->m_data, $this->m_gih->m_nWidth); |
915 | 915 | |
916 | - $data = substr($data, 0, $y * $this->m_gih->m_nWidth) . $lne . substr($data, ($y + 1) * $this->m_gih->m_nWidth); |
|
916 | + $data = substr($data, 0, $y * $this->m_gih->m_nWidth).$lne.substr($data, ($y + 1) * $this->m_gih->m_nWidth); |
|
917 | 917 | } |
918 | 918 | } |
919 | 919 | |
@@ -1286,7 +1286,7 @@ discard block |
||
1286 | 1286 | { |
1287 | 1287 | $val = (int)$val; |
1288 | 1288 | |
1289 | - return chr($val & 0xFF) . chr(($val & 0xFF00) >> 8) . chr(($val & 0xFF0000) >> 16) . chr(($val & 0xFF000000) >> 24); |
|
1289 | + return chr($val & 0xFF).chr(($val & 0xFF00) >> 8).chr(($val & 0xFF0000) >> 16).chr(($val & 0xFF000000) >> 24); |
|
1290 | 1290 | } |
1291 | 1291 | |
1292 | 1292 | /////////////////////////////////////////////////////////////////////////// |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | { |
1300 | 1300 | $val = (int)$val; |
1301 | 1301 | |
1302 | - return chr(($val & 0xFF000000) >> 24) . chr(($val & 0xFF0000) >> 16) . chr(($val & 0xFF00) >> 8) . chr($val & 0xFF); |
|
1302 | + return chr(($val & 0xFF000000) >> 24).chr(($val & 0xFF0000) >> 16).chr(($val & 0xFF00) >> 8).chr($val & 0xFF); |
|
1303 | 1303 | } |
1304 | 1304 | |
1305 | 1305 | /////////////////////////////////////////////////////////////////////////// |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | // THIS CONFIG FILE ONLY APPLIES TO phpThumb.php // |
10 | 10 | // /// |
11 | 11 | ////////////////////////////////////////////////////////////// |
12 | -require dirname(dirname(__DIR__)) . '/header.php'; |
|
12 | +require dirname(dirname(__DIR__)).'/header.php'; |
|
13 | 13 | ob_start(); |
14 | -if (!file_exists(__DIR__ . '/phpthumb.functions.php') || !require_once __DIR__ . '/phpthumb.functions.php') { |
|
14 | +if (!file_exists(__DIR__.'/phpthumb.functions.php') || !require_once __DIR__.'/phpthumb.functions.php') { |
|
15 | 15 | ob_end_flush(); |
16 | - die('failed to include_once(phpthumb.functions.php) - realpath="' . realpath(__DIR__ . '/phpthumb.functions.php') . '"'); |
|
16 | + die('failed to include_once(phpthumb.functions.php) - realpath="'.realpath(__DIR__.'/phpthumb.functions.php').'"'); |
|
17 | 17 | } |
18 | 18 | ob_end_clean(); |
19 | 19 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | // * Cache directory configuration (choose only one of these - leave the other lines commented-out): |
33 | 33 | // Note: this directory must be writable (usually chmod 777 is neccesary) for caching to work. |
34 | 34 | // If the directory is not writable no error will be generated but caching will be disabled. |
35 | -$PHPTHUMB_CONFIG['cache_directory'] = XOOPS_CACHE_PATH; // set the cache directory relative to the phpThumb() installation |
|
35 | +$PHPTHUMB_CONFIG['cache_directory'] = XOOPS_CACHE_PATH; // set the cache directory relative to the phpThumb() installation |
|
36 | 36 | //$PHPTHUMB_CONFIG['cache_directory'] = $PHPTHUMB_CONFIG['document_root'].'/phpthumb/cache/'; // set the cache directory to an absolute directory for all source images |
37 | 37 | //$PHPTHUMB_CONFIG['cache_directory'] = './cache/'; // set the cache directory relative to the source image - must start with '.' (will not work to cache URL- or database-sourced images, please use an absolute directory name) |
38 | 38 | //$PHPTHUMB_CONFIG['cache_directory'] = null; // disable thumbnail caching (not recommended) |
@@ -50,35 +50,35 @@ discard block |
||
50 | 50 | // based on last-access date and/or number of files and/or total filesize. |
51 | 51 | |
52 | 52 | //$PHPTHUMB_CONFIG['cache_maxage'] = null; // never delete cached thumbnails based on last-access time |
53 | -$PHPTHUMB_CONFIG['cache_maxage'] = 86400 * 30; // delete cached thumbnails that haven't been accessed in more than [30 days] (value is maximum time since last access in seconds to avoid deletion) |
|
53 | +$PHPTHUMB_CONFIG['cache_maxage'] = 86400 * 30; // delete cached thumbnails that haven't been accessed in more than [30 days] (value is maximum time since last access in seconds to avoid deletion) |
|
54 | 54 | |
55 | 55 | //$PHPTHUMB_CONFIG['cache_maxsize'] = null; // never delete cached thumbnails based on byte size of cache directory |
56 | 56 | $PHPTHUMB_CONFIG['cache_maxsize'] = 10 * 1024 * 1024; // delete least-recently-accessed cached thumbnails when more than [10MB] of cached files are present (value is maximum bytesize of all cached files) |
57 | 57 | |
58 | 58 | //$PHPTHUMB_CONFIG['cache_maxfiles'] = null; // never delete cached thumbnails based on number of cached files |
59 | -$PHPTHUMB_CONFIG['cache_maxfiles'] = 200; // delete least-recently-accessed cached thumbnails when more than [200] cached files are present (value is maximum number of cached files to keep) |
|
59 | +$PHPTHUMB_CONFIG['cache_maxfiles'] = 200; // delete least-recently-accessed cached thumbnails when more than [200] cached files are present (value is maximum number of cached files to keep) |
|
60 | 60 | |
61 | 61 | // * Source image cache configuration |
62 | -$PHPTHUMB_CONFIG['cache_source_enabled'] = true; // if true, source images obtained via HTTP are cached to $PHPTHUMB_CONFIG['cache_source_directory'] |
|
63 | -$PHPTHUMB_CONFIG['cache_source_directory'] = XOOPS_CACHE_PATH; // set the cache directory for unprocessed source images |
|
62 | +$PHPTHUMB_CONFIG['cache_source_enabled'] = true; // if true, source images obtained via HTTP are cached to $PHPTHUMB_CONFIG['cache_source_directory'] |
|
63 | +$PHPTHUMB_CONFIG['cache_source_directory'] = XOOPS_CACHE_PATH; // set the cache directory for unprocessed source images |
|
64 | 64 | |
65 | 65 | // * cache source modification date configuration |
66 | 66 | $PHPTHUMB_CONFIG['cache_source_filemtime_ignore_local'] = false; // if true, local source images will not be checked for modification date and cached image will be used if available, even if source image is changed or removed |
67 | -$PHPTHUMB_CONFIG['cache_source_filemtime_ignore_remote'] = true; // if true, remote source images will not be checked for modification date and cached image will be used if available, even if source image is changed or removed. WARNING: cached performance MUCH slower if this is set to false. |
|
67 | +$PHPTHUMB_CONFIG['cache_source_filemtime_ignore_remote'] = true; // if true, remote source images will not be checked for modification date and cached image will be used if available, even if source image is changed or removed. WARNING: cached performance MUCH slower if this is set to false. |
|
68 | 68 | |
69 | 69 | // * Simplified cache filename configuration |
70 | 70 | // Instead of creating unique cache filenames for all parameter combinations, create "simple" cache files (eg: "pic_thumb.jpg") |
71 | 71 | // If cache_default_only_suffix is non-empty, GETstring parameters (except 'src') are ignored and only $PHPTHUMB_DEFAULTS |
72 | 72 | // parameters (set at the bottom of phpThumb.config.php) are used for processing. |
73 | 73 | // The '*' character MUST be used to represent the source image name |
74 | -$PHPTHUMB_CONFIG['cache_default_only_suffix'] = ''; // cached in normal phpThumb manner |
|
74 | +$PHPTHUMB_CONFIG['cache_default_only_suffix'] = ''; // cached in normal phpThumb manner |
|
75 | 75 | //$PHPTHUMB_CONFIG['cache_default_only_suffix'] = '*_thumb'; // cache 'pic.jpg' becomes 'pic_thumb.jpg' (or 'pic_thumb.png' if PNG output is selected, etc) |
76 | 76 | //$PHPTHUMB_CONFIG['cache_default_only_suffix'] = 'small-*'; // cache 'pic.jpg' becomes 'small-pic.jpg' (or 'small-pic.png' if PNG output is selected, etc) |
77 | 77 | |
78 | -$PHPTHUMB_CONFIG['cache_prefix'] = 'phpThumb_cache_' . (isset($_SERVER['SERVER_NAME']) ? str_replace('www.', '', $_SERVER['SERVER_NAME']) . '_' : ''); // keep cache file separate by domain |
|
78 | +$PHPTHUMB_CONFIG['cache_prefix'] = 'phpThumb_cache_'.(isset($_SERVER['SERVER_NAME']) ? str_replace('www.', '', $_SERVER['SERVER_NAME']).'_' : ''); // keep cache file separate by domain |
|
79 | 79 | //$PHPTHUMB_CONFIG['cache_prefix'] = 'phpThumb_cache'; // allow phpThumb to share 1 set of cached files even if accessed under different servername/domains on same server |
80 | 80 | |
81 | -$PHPTHUMB_CONFIG['cache_force_passthru'] = true; // if true, cached image data will always be passed to browser; if false, HTTP redirect will be used instead |
|
81 | +$PHPTHUMB_CONFIG['cache_force_passthru'] = true; // if true, cached image data will always be passed to browser; if false, HTTP redirect will be used instead |
|
82 | 82 | |
83 | 83 | // * Temp directory configuration |
84 | 84 | // phpThumb() may need to create temp files. Usually the system temp dir is writable and can be used. |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | // you should change this to a full pathname to a directory you do have write access to. |
87 | 87 | //$PHPTHUMB_CONFIG['temp_directory'] = null; // attempt to auto-detect |
88 | 88 | //$PHPTHUMB_CONFIG['temp_directory'] = '/tmp/persistent/phpthumb/cache/'; // set to absolute path |
89 | -$PHPTHUMB_CONFIG['temp_directory'] = $PHPTHUMB_CONFIG['cache_directory']; // set to same as cache directory |
|
89 | +$PHPTHUMB_CONFIG['temp_directory'] = $PHPTHUMB_CONFIG['cache_directory']; // set to same as cache directory |
|
90 | 90 | |
91 | 91 | // NOTE: "max_source_pixels" only affects GD-resized thumbnails. If you have ImageMagick |
92 | 92 | // installed it will bypass most of these limits |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | if (phpthumb_functions::version_compare_replacement(PHP_VERSION, '4.3.2', '>=') && !defined('memory_get_usage') |
105 | 105 | && !@ini_get('memory_limit')) { |
106 | 106 | // memory_get_usage() will only be defined if your PHP is compiled with the --enable-memory-limit configuration option. |
107 | - $PHPTHUMB_CONFIG['max_source_pixels'] = 0; // no memory limit |
|
107 | + $PHPTHUMB_CONFIG['max_source_pixels'] = 0; // no memory limit |
|
108 | 108 | } else { |
109 | 109 | // calculate default max_source_pixels as 1/6 of memory limit configuration |
110 | 110 | $PHPTHUMB_CONFIG['max_source_pixels'] = round(max((int)ini_get('memory_limit'), (int)get_cfg_var('memory_limit')) * 1048576 / 6); |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | // ImageMagick configuration |
118 | -$PHPTHUMB_CONFIG['prefer_imagemagick'] = true; // If true, use ImageMagick to resize thumbnails if possible, since it is usually faster than GD functions; if false only use ImageMagick if PHP memory limit is too low. |
|
119 | -$PHPTHUMB_CONFIG['imagemagick_use_thumbnail'] = true; // If true, use ImageMagick's "-thumbnail" resizing parameter (if available) which removes extra non-image metadata (profiles, EXIF info, etc) resulting in much smaller filesize; if false, use "-resize" paramter which retains this info |
|
118 | +$PHPTHUMB_CONFIG['prefer_imagemagick'] = true; // If true, use ImageMagick to resize thumbnails if possible, since it is usually faster than GD functions; if false only use ImageMagick if PHP memory limit is too low. |
|
119 | +$PHPTHUMB_CONFIG['imagemagick_use_thumbnail'] = true; // If true, use ImageMagick's "-thumbnail" resizing parameter (if available) which removes extra non-image metadata (profiles, EXIF info, etc) resulting in much smaller filesize; if false, use "-resize" paramter which retains this info |
|
120 | 120 | if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) { |
121 | 121 | // Windows: set absolute pathname |
122 | 122 | $PHPTHUMB_CONFIG['imagemagick_path'] = 'C:/ImageMagick/convert.exe'; |
@@ -128,41 +128,41 @@ discard block |
||
128 | 128 | |
129 | 129 | // * Default output configuration: |
130 | 130 | $PHPTHUMB_CONFIG['output_format'] = 'png'; // default output format ('jpeg', 'png' or 'gif') - thumbnail will be output in this format (if available in your version of GD or ImageMagick). This is only used if the "f" parameter is not specified, and if the thumbnail can't be output in the input format. |
131 | -$PHPTHUMB_CONFIG['output_maxwidth'] = 0; // default maximum thumbnail width. If this is zero then default width is the width of the source image. This is always overridden by ?w=___ GETstring parameter |
|
132 | -$PHPTHUMB_CONFIG['output_maxheight'] = 0; // default maximum thumbnail height. If this is zero then default height is the height of the source image. This is always overridden by ?h=___ GETstring parameter |
|
133 | -$PHPTHUMB_CONFIG['output_interlace'] = true; // if true: interlaced output for GIF/PNG, progressive output for JPEG; if false: non-interlaced for GIF/PNG, baseline for JPEG. |
|
131 | +$PHPTHUMB_CONFIG['output_maxwidth'] = 0; // default maximum thumbnail width. If this is zero then default width is the width of the source image. This is always overridden by ?w=___ GETstring parameter |
|
132 | +$PHPTHUMB_CONFIG['output_maxheight'] = 0; // default maximum thumbnail height. If this is zero then default height is the height of the source image. This is always overridden by ?h=___ GETstring parameter |
|
133 | +$PHPTHUMB_CONFIG['output_interlace'] = true; // if true: interlaced output for GIF/PNG, progressive output for JPEG; if false: non-interlaced for GIF/PNG, baseline for JPEG. |
|
134 | 134 | |
135 | 135 | // * Error message configuration |
136 | -$PHPTHUMB_CONFIG['error_image_width'] = 300; // default width for error images |
|
137 | -$PHPTHUMB_CONFIG['error_image_height'] = 100; // default height for error images |
|
138 | -$PHPTHUMB_CONFIG['error_message_image_default'] = ''; // Set this to the name of a generic error image (e.g. '/images/error.png') that you want displayed in place of any error message that may occur. This setting is overridden by the 'err' parameter, which does the same thing. |
|
136 | +$PHPTHUMB_CONFIG['error_image_width'] = 300; // default width for error images |
|
137 | +$PHPTHUMB_CONFIG['error_image_height'] = 100; // default height for error images |
|
138 | +$PHPTHUMB_CONFIG['error_message_image_default'] = ''; // Set this to the name of a generic error image (e.g. '/images/error.png') that you want displayed in place of any error message that may occur. This setting is overridden by the 'err' parameter, which does the same thing. |
|
139 | 139 | $PHPTHUMB_CONFIG['error_bgcolor'] = 'CCCCFF'; // background color of error message images |
140 | 140 | $PHPTHUMB_CONFIG['error_textcolor'] = 'FF0000'; // color of text in error messages |
141 | -$PHPTHUMB_CONFIG['error_fontsize'] = 1; // size of text in error messages, from 1 (smallest) to 5 (largest) |
|
142 | -$PHPTHUMB_CONFIG['error_die_on_error'] = true; // die with error message on any fatal error (recommended with standalone phpThumb.php) |
|
143 | -$PHPTHUMB_CONFIG['error_silent_die_on_error'] = false; // simply die with no output of any kind on fatal errors (not recommended) |
|
144 | -$PHPTHUMB_CONFIG['error_die_on_source_failure'] = true; // die with error message if source image cannot be processed by phpThumb() (usually because source image is corrupt in some way). If false the source image will be passed through unprocessed, if true (default) an error message will be displayed. |
|
141 | +$PHPTHUMB_CONFIG['error_fontsize'] = 1; // size of text in error messages, from 1 (smallest) to 5 (largest) |
|
142 | +$PHPTHUMB_CONFIG['error_die_on_error'] = true; // die with error message on any fatal error (recommended with standalone phpThumb.php) |
|
143 | +$PHPTHUMB_CONFIG['error_silent_die_on_error'] = false; // simply die with no output of any kind on fatal errors (not recommended) |
|
144 | +$PHPTHUMB_CONFIG['error_die_on_source_failure'] = true; // die with error message if source image cannot be processed by phpThumb() (usually because source image is corrupt in some way). If false the source image will be passed through unprocessed, if true (default) an error message will be displayed. |
|
145 | 145 | |
146 | 146 | // * Off-server Thumbnailing Configuration: |
147 | -$PHPTHUMB_CONFIG['nohotlink_enabled'] = false; // If false will allow thumbnailing from any source domain |
|
148 | -$PHPTHUMB_CONFIG['nohotlink_valid_domains'] = [@$_SERVER['HTTP_HOST']]; // This is the list of domains for which thumbnails are allowed to be created. Note: domain only, do not include port numbers. The default value of the current domain should be fine in most cases, but if neccesary you can add more domains in here, in the format "www.example.com" |
|
149 | -$PHPTHUMB_CONFIG['nohotlink_erase_image'] = true; // if true thumbnail is covered up with $PHPTHUMB_CONFIG['nohotlink_fill_color'] before text is applied, if false text is written over top of thumbnail |
|
147 | +$PHPTHUMB_CONFIG['nohotlink_enabled'] = false; // If false will allow thumbnailing from any source domain |
|
148 | +$PHPTHUMB_CONFIG['nohotlink_valid_domains'] = [@$_SERVER['HTTP_HOST']]; // This is the list of domains for which thumbnails are allowed to be created. Note: domain only, do not include port numbers. The default value of the current domain should be fine in most cases, but if neccesary you can add more domains in here, in the format "www.example.com" |
|
149 | +$PHPTHUMB_CONFIG['nohotlink_erase_image'] = true; // if true thumbnail is covered up with $PHPTHUMB_CONFIG['nohotlink_fill_color'] before text is applied, if false text is written over top of thumbnail |
|
150 | 150 | $PHPTHUMB_CONFIG['nohotlink_text_message'] = 'Off-server thumbnailing is not allowed'; // text of error message |
151 | 151 | |
152 | 152 | // * Off-server Linking Configuration: |
153 | -$PHPTHUMB_CONFIG['nooffsitelink_enabled'] = false; // If false will allow thumbnails to be linked to from any domain, if true only domains listed below in 'nooffsitelink_valid_domains' will be allowed. |
|
154 | -$PHPTHUMB_CONFIG['nooffsitelink_valid_domains'] = [@$_SERVER['HTTP_HOST']]; // This is the list of domains for which thumbnails are allowed to be created. The default value of the current domain should be fine in most cases, but if neccesary you can add more domains in here, in the format 'www.example.com' |
|
155 | -$PHPTHUMB_CONFIG['nooffsitelink_require_refer'] = false; // If false will allow standalone calls to phpThumb(). If true then only requests with a Request::getString('HTTP_REFERER', '', 'SERVER') value in 'nooffsitelink_valid_domains' are allowed. |
|
156 | -$PHPTHUMB_CONFIG['nooffsitelink_erase_image'] = false; // if true thumbnail is covered up with $PHPTHUMB_CONFIG['nohotlink_fill_color'] before text is applied, if false text is written over top of thumbnail |
|
157 | -$PHPTHUMB_CONFIG['nooffsitelink_watermark_src'] = '/demo/images/watermark.png'; // webroot-relative image to overlay on hotlinked images |
|
158 | -$PHPTHUMB_CONFIG['nooffsitelink_text_message'] = 'Image taken from ' . @$_SERVER['HTTP_HOST']; // text of error message (used if [nooffsitelink_watermark_src] is not a valid image) |
|
153 | +$PHPTHUMB_CONFIG['nooffsitelink_enabled'] = false; // If false will allow thumbnails to be linked to from any domain, if true only domains listed below in 'nooffsitelink_valid_domains' will be allowed. |
|
154 | +$PHPTHUMB_CONFIG['nooffsitelink_valid_domains'] = [@$_SERVER['HTTP_HOST']]; // This is the list of domains for which thumbnails are allowed to be created. The default value of the current domain should be fine in most cases, but if neccesary you can add more domains in here, in the format 'www.example.com' |
|
155 | +$PHPTHUMB_CONFIG['nooffsitelink_require_refer'] = false; // If false will allow standalone calls to phpThumb(). If true then only requests with a Request::getString('HTTP_REFERER', '', 'SERVER') value in 'nooffsitelink_valid_domains' are allowed. |
|
156 | +$PHPTHUMB_CONFIG['nooffsitelink_erase_image'] = false; // if true thumbnail is covered up with $PHPTHUMB_CONFIG['nohotlink_fill_color'] before text is applied, if false text is written over top of thumbnail |
|
157 | +$PHPTHUMB_CONFIG['nooffsitelink_watermark_src'] = '/demo/images/watermark.png'; // webroot-relative image to overlay on hotlinked images |
|
158 | +$PHPTHUMB_CONFIG['nooffsitelink_text_message'] = 'Image taken from '.@$_SERVER['HTTP_HOST']; // text of error message (used if [nooffsitelink_watermark_src] is not a valid image) |
|
159 | 159 | |
160 | 160 | // * Border & Background default colors |
161 | 161 | $PHPTHUMB_CONFIG['border_hexcolor'] = '000000'; // Default border color - usual HTML-style hex color notation (overridden with 'bc' parameter) |
162 | 162 | $PHPTHUMB_CONFIG['background_hexcolor'] = 'FFFFFF'; // Default background color when thumbnail aspect ratio does not match fixed-dimension box - usual HTML-style hex color notation (overridden with 'bg' parameter) |
163 | 163 | |
164 | 164 | // * Watermark configuration |
165 | -$PHPTHUMB_CONFIG['ttf_directory'] = __DIR__ . '/fonts'; // Base directory for TTF font files |
|
165 | +$PHPTHUMB_CONFIG['ttf_directory'] = __DIR__.'/fonts'; // Base directory for TTF font files |
|
166 | 166 | //$PHPTHUMB_CONFIG['ttf_directory'] = 'c:/windows/fonts'; |
167 | 167 | |
168 | 168 | // * MySQL configuration |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | $PHPTHUMB_CONFIG['mysql_database'] = ''; |
181 | 181 | |
182 | 182 | // * Security configuration |
183 | -$PHPTHUMB_CONFIG['high_security_enabled'] = false; // if enabled, requires 'high_security_password' set to be set and requires the use of phpThumbURL() function (at the bottom of phpThumb.config.php) to generate hashed URLs |
|
184 | -$PHPTHUMB_CONFIG['high_security_password'] = ''; // required if 'high_security_enabled' is true, and must be at complex (uppercase, lowercase, numbers, punctuation, etc -- punctuation is strongest, lowercase is weakest; see PasswordStrength() in phpThumb.php). You can use a password generator like http://silisoftware.com/tools/password-random.php to generate a strong password |
|
185 | -$PHPTHUMB_CONFIG['disable_debug'] = true; // prevent phpThumb from displaying any information about your system. If true, phpThumbDebug and error messages will be disabled |
|
186 | -$PHPTHUMB_CONFIG['allow_src_above_docroot'] = true; // if true, allow src to be anywhere in filesystem; if false (default) only allow src within document_root |
|
187 | -$PHPTHUMB_CONFIG['allow_src_above_phpthumb'] = true; // if true (default), allow src to be anywhere in filesystem; if false only allow src within sub-directory of phpThumb installation |
|
188 | -$PHPTHUMB_CONFIG['allow_parameter_file'] = false; // if true, allow use of 'file' parameter; if false (default) the 'file' parameter is disabled/ignored |
|
189 | -$PHPTHUMB_CONFIG['allow_parameter_goto'] = false; // if true, allow use of 'goto' parameter; if false (default) the 'goto' parameter is disabled/ignored |
|
183 | +$PHPTHUMB_CONFIG['high_security_enabled'] = false; // if enabled, requires 'high_security_password' set to be set and requires the use of phpThumbURL() function (at the bottom of phpThumb.config.php) to generate hashed URLs |
|
184 | +$PHPTHUMB_CONFIG['high_security_password'] = ''; // required if 'high_security_enabled' is true, and must be at complex (uppercase, lowercase, numbers, punctuation, etc -- punctuation is strongest, lowercase is weakest; see PasswordStrength() in phpThumb.php). You can use a password generator like http://silisoftware.com/tools/password-random.php to generate a strong password |
|
185 | +$PHPTHUMB_CONFIG['disable_debug'] = true; // prevent phpThumb from displaying any information about your system. If true, phpThumbDebug and error messages will be disabled |
|
186 | +$PHPTHUMB_CONFIG['allow_src_above_docroot'] = true; // if true, allow src to be anywhere in filesystem; if false (default) only allow src within document_root |
|
187 | +$PHPTHUMB_CONFIG['allow_src_above_phpthumb'] = true; // if true (default), allow src to be anywhere in filesystem; if false only allow src within sub-directory of phpThumb installation |
|
188 | +$PHPTHUMB_CONFIG['allow_parameter_file'] = false; // if true, allow use of 'file' parameter; if false (default) the 'file' parameter is disabled/ignored |
|
189 | +$PHPTHUMB_CONFIG['allow_parameter_goto'] = false; // if true, allow use of 'goto' parameter; if false (default) the 'goto' parameter is disabled/ignored |
|
190 | 190 | |
191 | 191 | // * HTTP UserAgent configuration |
192 | 192 | //$PHPTHUMB_CONFIG['http_user_agent'] = ''; // PHP default: none |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | $PHPTHUMB_CONFIG['http_user_agent'] = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7'; // Windows XP, Firefox |
195 | 195 | |
196 | 196 | // * Compatibility settings |
197 | -$PHPTHUMB_CONFIG['disable_pathinfo_parsing'] = false; // if true, $_SERVER[PATH_INFO] is not parsed. May be needed on some server configurations to allow normal behavior. |
|
198 | -$PHPTHUMB_CONFIG['disable_imagecopyresampled'] = false; // if true, ImageCopyResampled is replaced with ImageCopyResampleBicubic. May be needed for buggy versions of PHP-GD. |
|
199 | -$PHPTHUMB_CONFIG['disable_onlycreateable_passthru'] = true; // if true, any image that can be parsed by getimagesize() can be passed through; if false, only images that can be converted to GD by ImageCreateFrom(JPEG|GIF|PNG) functions are allowed |
|
197 | +$PHPTHUMB_CONFIG['disable_pathinfo_parsing'] = false; // if true, $_SERVER[PATH_INFO] is not parsed. May be needed on some server configurations to allow normal behavior. |
|
198 | +$PHPTHUMB_CONFIG['disable_imagecopyresampled'] = false; // if true, ImageCopyResampled is replaced with ImageCopyResampleBicubic. May be needed for buggy versions of PHP-GD. |
|
199 | +$PHPTHUMB_CONFIG['disable_onlycreateable_passthru'] = true; // if true, any image that can be parsed by getimagesize() can be passed through; if false, only images that can be converted to GD by ImageCreateFrom(JPEG|GIF|PNG) functions are allowed |
|
200 | 200 | |
201 | 201 | // * HTTP remote file opening settings |
202 | -$PHPTHUMB_CONFIG['http_fopen_timeout'] = 10; // timeout (in seconds) for fopen / curl / fsockopen |
|
202 | +$PHPTHUMB_CONFIG['http_fopen_timeout'] = 10; // timeout (in seconds) for fopen / curl / fsockopen |
|
203 | 203 | $PHPTHUMB_CONFIG['http_follow_redirect'] = true; // if true (default), follow "302 Found" redirects to new URL; if false, return error message |
204 | 204 | |
205 | 205 | // * Speed optimizations configuration |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | // START DEFAULT PARAMETERS SECTION |
214 | 214 | // If any parameters are constant across ALL images, you can set them here |
215 | 215 | |
216 | -$PHPTHUMB_DEFAULTS_GETSTRINGOVERRIDE = true; // if true, any parameters in the URL will override the defaults set here; if false, any parameters set here cannot be overridden in the URL |
|
216 | +$PHPTHUMB_DEFAULTS_GETSTRINGOVERRIDE = true; // if true, any parameters in the URL will override the defaults set here; if false, any parameters set here cannot be overridden in the URL |
|
217 | 217 | $PHPTHUMB_DEFAULTS_DISABLEGETPARAMS = false; // if true, GETstring parameters will be ignored (except for 'src') and only below default parameters will be used; if false, both default and GETstring parameters will be used (depending on $PHPTHUMB_DEFAULTS_GETSTRINGOVERRIDE). Will be auto-set true if !empty($PHPTHUMB_CONFIG['cache_default_only_suffix']) |
218 | 218 | |
219 | 219 | //$PHPTHUMB_DEFAULTS['w'] = 200; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | { |
237 | 237 | global $PHPTHUMB_CONFIG; |
238 | 238 | |
239 | - return str_replace(@$PHPTHUMB_CONFIG['document_root'], '', __DIR__) . DIRECTORY_SEPARATOR . 'phpThumb.php?' . $ParameterString . '&hash=' . md5($ParameterString . @$PHPTHUMB_CONFIG['high_security_password']); |
|
239 | + return str_replace(@$PHPTHUMB_CONFIG['document_root'], '', __DIR__).DIRECTORY_SEPARATOR.'phpThumb.php?'.$ParameterString.'&hash='.md5($ParameterString.@$PHPTHUMB_CONFIG['high_security_password']); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /////////////////////////////////////////////////////////////////////////////// |
@@ -92,12 +92,12 @@ |
||
92 | 92 | // Move copies of the image around one pixel at the time and merge them with weight |
93 | 93 | // according to the matrix. The same matrix is simply repeated for higher radii. |
94 | 94 | for ($i = 0; $i < $radius; $i++) { |
95 | - imagecopy($imgBlur, $img, 0, 0, 1, 0, $w - 1, $h); // left |
|
96 | - imagecopymerge($imgBlur, $img, 1, 0, 0, 0, $w, $h, 50); // right |
|
97 | - imagecopymerge($imgBlur, $img, 0, 0, 0, 0, $w, $h, 50); // center |
|
95 | + imagecopy($imgBlur, $img, 0, 0, 1, 0, $w - 1, $h); // left |
|
96 | + imagecopymerge($imgBlur, $img, 1, 0, 0, 0, $w, $h, 50); // right |
|
97 | + imagecopymerge($imgBlur, $img, 0, 0, 0, 0, $w, $h, 50); // center |
|
98 | 98 | imagecopy($imgCanvas, $imgBlur, 0, 0, 0, 0, $w, $h); |
99 | 99 | imagecopymerge($imgBlur, $imgCanvas, 0, 0, 0, 1, $w, $h - 1, 33.33333); // up |
100 | - imagecopymerge($imgBlur, $imgCanvas, 0, 1, 0, 0, $w, $h, 25); // down |
|
100 | + imagecopymerge($imgBlur, $imgCanvas, 0, 1, 0, 0, $w, $h, 25); // down |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | public function ApplyMask(&$gdimg_mask, &$gdimg_image) |
45 | 45 | { |
46 | 46 | if (phpthumb_functions::gd_version() < 2) { |
47 | - $this->DebugMessage('Skipping ApplyMask() because gd_version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__); |
|
47 | + $this->DebugMessage('Skipping ApplyMask() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__); |
|
48 | 48 | |
49 | 49 | return false; |
50 | 50 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | } else { |
82 | 82 | // alpha merging requires PHP v4.3.2+ |
83 | - $this->DebugMessage('Skipping ApplyMask() technique because PHP is v"' . PHP_VERSION . '"', __FILE__, __LINE__); |
|
83 | + $this->DebugMessage('Skipping ApplyMask() technique because PHP is v"'.PHP_VERSION.'"', __FILE__, __LINE__); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | return true; |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | // Move copies of the image around one pixel at the time and merge them with weight |
140 | 140 | // according to the matrix. The same matrix is simply repeated for higher radii. |
141 | 141 | for ($i = 0; $i < $radius; $i++) { |
142 | - imagecopy($imgBlur, $gdimg, 0, 0, 1, 1, $w - 1, $h - 1); // up left |
|
143 | - imagecopymerge($imgBlur, $gdimg, 1, 1, 0, 0, $w, $h, 50.00000); // down right |
|
144 | - imagecopymerge($imgBlur, $gdimg, 0, 1, 1, 0, $w - 1, $h, 33.33333); // down left |
|
145 | - imagecopymerge($imgBlur, $gdimg, 1, 0, 0, 1, $w, $h - 1, 25.00000); // up right |
|
146 | - imagecopymerge($imgBlur, $gdimg, 0, 0, 1, 0, $w - 1, $h, 33.33333); // left |
|
147 | - imagecopymerge($imgBlur, $gdimg, 1, 0, 0, 0, $w, $h, 25.00000); // right |
|
148 | - imagecopymerge($imgBlur, $gdimg, 0, 0, 0, 1, $w, $h - 1, 20.00000); // up |
|
142 | + imagecopy($imgBlur, $gdimg, 0, 0, 1, 1, $w - 1, $h - 1); // up left |
|
143 | + imagecopymerge($imgBlur, $gdimg, 1, 1, 0, 0, $w, $h, 50.00000); // down right |
|
144 | + imagecopymerge($imgBlur, $gdimg, 0, 1, 1, 0, $w - 1, $h, 33.33333); // down left |
|
145 | + imagecopymerge($imgBlur, $gdimg, 1, 0, 0, 1, $w, $h - 1, 25.00000); // up right |
|
146 | + imagecopymerge($imgBlur, $gdimg, 0, 0, 1, 0, $w - 1, $h, 33.33333); // left |
|
147 | + imagecopymerge($imgBlur, $gdimg, 1, 0, 0, 0, $w, $h, 25.00000); // right |
|
148 | + imagecopymerge($imgBlur, $gdimg, 0, 0, 0, 1, $w, $h - 1, 20.00000); // up |
|
149 | 149 | imagecopymerge($imgBlur, $gdimg, 0, 1, 0, 0, $w, $h, 16.666667); // down |
150 | 150 | imagecopymerge($imgBlur, $gdimg, 0, 0, 0, 0, $w, $h, 50.000000); // center |
151 | 151 | imagecopy($gdimg, $imgBlur, 0, 0, 0, 0, $w, $h); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | if (imagefilter($gdimg, IMG_FILTER_BRIGHTNESS, $amount)) { |
214 | 214 | return true; |
215 | 215 | } |
216 | - $this->DebugMessage('FAILED: imagefilter($gdimg, IMG_FILTER_BRIGHTNESS, ' . $amount . ')', __FILE__, __LINE__); |
|
216 | + $this->DebugMessage('FAILED: imagefilter($gdimg, IMG_FILTER_BRIGHTNESS, '.$amount.')', __FILE__, __LINE__); |
|
217 | 217 | // fall through and try it the hard way |
218 | 218 | } |
219 | 219 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | if (imagefilter($gdimg, IMG_FILTER_CONTRAST, $amount)) { |
254 | 254 | return true; |
255 | 255 | } |
256 | - $this->DebugMessage('FAILED: imagefilter($gdimg, IMG_FILTER_CONTRAST, ' . $amount . ')', __FILE__, __LINE__); |
|
256 | + $this->DebugMessage('FAILED: imagefilter($gdimg, IMG_FILTER_CONTRAST, '.$amount.')', __FILE__, __LINE__); |
|
257 | 257 | // fall through and try it the hard way |
258 | 258 | } |
259 | 259 | |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | 'a' => 'alpha', |
719 | 719 | '*' => (0 == $method) ? 'all' : 'gray' |
720 | 720 | ]; |
721 | - $band = substr($band, 0, 1); |
|
721 | + $band = substr($band, 0, 1); |
|
722 | 722 | if (!isset($keys[$band])) { |
723 | 723 | return false; |
724 | 724 | } |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | |
941 | 941 | return true; |
942 | 942 | } else { |
943 | - $this->DebugMessage('FAILED: $gd_border_canvas = phpthumb_functions::ImageCreateFunction(' . $output_width . ', ' . $output_height . ')', __FILE__, __LINE__); |
|
943 | + $this->DebugMessage('FAILED: $gd_border_canvas = phpthumb_functions::ImageCreateFunction('.$output_width.', '.$output_height.')', __FILE__, __LINE__); |
|
944 | 944 | } |
945 | 945 | |
946 | 946 | return false; |
@@ -1115,15 +1115,15 @@ discard block |
||
1115 | 1115 | |
1116 | 1116 | self::ApplyMask($gdimg_cornermask, $gdimg); |
1117 | 1117 | imagedestroy($gdimg_cornermask); |
1118 | - $this->DebugMessage('RoundedImageCorners(' . $radius_x . ', ' . $radius_y . ') succeeded', __FILE__, __LINE__); |
|
1118 | + $this->DebugMessage('RoundedImageCorners('.$radius_x.', '.$radius_y.') succeeded', __FILE__, __LINE__); |
|
1119 | 1119 | |
1120 | 1120 | return true; |
1121 | 1121 | } else { |
1122 | - $this->DebugMessage('FAILED: $gdimg_cornermask = phpthumb_functions::ImageCreateFunction(' . imagesx($gdimg) . ', ' . imagesy($gdimg) . ')', __FILE__, __LINE__); |
|
1122 | + $this->DebugMessage('FAILED: $gdimg_cornermask = phpthumb_functions::ImageCreateFunction('.imagesx($gdimg).', '.imagesy($gdimg).')', __FILE__, __LINE__); |
|
1123 | 1123 | } |
1124 | 1124 | imagedestroy($gdimg_cornermask_triple); |
1125 | 1125 | } else { |
1126 | - $this->DebugMessage('FAILED: $gdimg_cornermask_triple = phpthumb_functions::ImageCreateFunction(' . ($radius_x * 6) . ', ' . ($radius_y * 6) . ')', __FILE__, __LINE__); |
|
1126 | + $this->DebugMessage('FAILED: $gdimg_cornermask_triple = phpthumb_functions::ImageCreateFunction('.($radius_x * 6).', '.($radius_y * 6).')', __FILE__, __LINE__); |
|
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | return false; |
@@ -1225,11 +1225,11 @@ discard block |
||
1225 | 1225 | if (imagefilter($gdimg, IMG_FILTER_SMOOTH, $amount)) { |
1226 | 1226 | return true; |
1227 | 1227 | } |
1228 | - $this->DebugMessage('FAILED: imagefilter($gdimg, IMG_FILTER_SMOOTH, ' . $amount . ')', __FILE__, __LINE__); |
|
1228 | + $this->DebugMessage('FAILED: imagefilter($gdimg, IMG_FILTER_SMOOTH, '.$amount.')', __FILE__, __LINE__); |
|
1229 | 1229 | // fall through and try it the hard way |
1230 | 1230 | } |
1231 | 1231 | // currently not implemented "the hard way" |
1232 | - $this->DebugMessage('FAILED: phpthumb_filters::Smooth($gdimg, ' . $amount . ') [function not implemented]', __FILE__, __LINE__); |
|
1232 | + $this->DebugMessage('FAILED: phpthumb_filters::Smooth($gdimg, '.$amount.') [function not implemented]', __FILE__, __LINE__); |
|
1233 | 1233 | |
1234 | 1234 | return false; |
1235 | 1235 | } |
@@ -1423,18 +1423,18 @@ discard block |
||
1423 | 1423 | '^y' => imagesy($gdimg), |
1424 | 1424 | '^^' => '^', |
1425 | 1425 | ]; |
1426 | - $text = strtr($text, $metaTextArray); |
|
1426 | + $text = strtr($text, $metaTextArray); |
|
1427 | 1427 | |
1428 | 1428 | $text = str_replace("\r\n", "\n", $text); |
1429 | 1429 | $text = str_replace("\r", "\n", $text); |
1430 | 1430 | $textlines = explode("\n", $text); |
1431 | - $this->DebugMessage('Processing ' . count($textlines) . ' lines of text', __FILE__, __LINE__); |
|
1431 | + $this->DebugMessage('Processing '.count($textlines).' lines of text', __FILE__, __LINE__); |
|
1432 | 1432 | |
1433 | 1433 | if (@is_readable($ttffont) && is_file($ttffont)) { |
1434 | 1434 | $opacity = 100 - (int)max(min($opacity, 100), 0); |
1435 | 1435 | $letter_color_text = phpthumb_functions::ImageHexColorAllocate($gdimg, $hex_color, false, $opacity * 1.27); |
1436 | 1436 | |
1437 | - $this->DebugMessage('Using TTF font "' . $ttffont . '"', __FILE__, __LINE__); |
|
1437 | + $this->DebugMessage('Using TTF font "'.$ttffont.'"', __FILE__, __LINE__); |
|
1438 | 1438 | |
1439 | 1439 | $TTFbox = imagettfbbox($size, $angle, $ttffont, $text); |
1440 | 1440 | |
@@ -1535,7 +1535,7 @@ discard block |
||
1535 | 1535 | $y_TL = preg_match('#y#i', $fillextend) ? 0 : min($y1, $y2); |
1536 | 1536 | $x_BR = preg_match('#x#i', $fillextend) ? imagesx($gdimg) : max($x1, $x2); |
1537 | 1537 | $y_BR = preg_match('#y#i', $fillextend) ? imagesy($gdimg) : max($y1, $y2); |
1538 | - $this->DebugMessage('WatermarkText() calling imagefilledrectangle($gdimg, ' . $x_TL . ', ' . $y_TL . ', ' . $x_BR . ', ' . $y_BR . ', $text_color_background)', __FILE__, __LINE__); |
|
1538 | + $this->DebugMessage('WatermarkText() calling imagefilledrectangle($gdimg, '.$x_TL.', '.$y_TL.', '.$x_BR.', '.$y_BR.', $text_color_background)', __FILE__, __LINE__); |
|
1539 | 1539 | imagefilledrectangle($gdimg, $x_TL, $y_TL, $x_BR, $y_BR, $text_color_background); |
1540 | 1540 | |
1541 | 1541 | // end block for background color only |
@@ -1570,7 +1570,7 @@ discard block |
||
1570 | 1570 | } |
1571 | 1571 | |
1572 | 1572 | //imagettftext($gdimg, $size, $angle, $text_origin_x, $text_origin_y, $letter_color_text, $ttffont, $text); |
1573 | - $this->DebugMessage('WatermarkText() calling imagettftext($gdimg, ' . $size . ', ' . $angle . ', ' . $text_origin_x . ', ' . ($text_origin_y + $y_offset) . ', $letter_color_text, ' . $ttffont . ', ' . $line . ')', __FILE__, __LINE__); |
|
1573 | + $this->DebugMessage('WatermarkText() calling imagettftext($gdimg, '.$size.', '.$angle.', '.$text_origin_x.', '.($text_origin_y + $y_offset).', $letter_color_text, '.$ttffont.', '.$line.')', __FILE__, __LINE__); |
|
1574 | 1574 | imagettftext($gdimg, $size, $angle, $text_origin_x, $text_origin_y + $y_offset, $letter_color_text, $ttffont, $line); |
1575 | 1575 | |
1576 | 1576 | $y_offset += $char_height; |
@@ -1580,12 +1580,12 @@ discard block |
||
1580 | 1580 | return true; |
1581 | 1581 | } else { |
1582 | 1582 | $size = min(5, max(1, $size)); |
1583 | - $this->DebugMessage('Using built-in font (size=' . $size . ') for text watermark' . ($ttffont ? ' because $ttffont !is_readable(' . $ttffont . ')' : ''), __FILE__, __LINE__); |
|
1583 | + $this->DebugMessage('Using built-in font (size='.$size.') for text watermark'.($ttffont ? ' because $ttffont !is_readable('.$ttffont.')' : ''), __FILE__, __LINE__); |
|
1584 | 1584 | |
1585 | 1585 | $text_width = 0; |
1586 | 1586 | $text_height = 0; |
1587 | 1587 | foreach ($textlines as $dummy => $line) { |
1588 | - $text_width = max($text_width, imagefontwidth($size) * strlen($line)); |
|
1588 | + $text_width = max($text_width, imagefontwidth($size) * strlen($line)); |
|
1589 | 1589 | $text_height += imagefontheight($size); |
1590 | 1590 | } |
1591 | 1591 | if ($img_watermark = phpthumb_functions::ImageCreateFunction($text_width, $text_height)) { |
@@ -1596,7 +1596,7 @@ discard block |
||
1596 | 1596 | } else { |
1597 | 1597 | $text_color_background = phpthumb_functions::ImageHexColorAllocate($img_watermark, 'FFFFFF', false, 127); |
1598 | 1598 | } |
1599 | - $this->DebugMessage('WatermarkText() calling imagefilledrectangle($img_watermark, 0, 0, ' . imagesx($img_watermark) . ', ' . imagesy($img_watermark) . ', $text_color_background)', __FILE__, __LINE__); |
|
1599 | + $this->DebugMessage('WatermarkText() calling imagefilledrectangle($img_watermark, 0, 0, '.imagesx($img_watermark).', '.imagesy($img_watermark).', $text_color_background)', __FILE__, __LINE__); |
|
1600 | 1600 | imagefilledrectangle($img_watermark, 0, 0, imagesx($img_watermark), imagesy($img_watermark), $text_color_background); |
1601 | 1601 | |
1602 | 1602 | $img_watermark_mask = false; |
@@ -1675,10 +1675,10 @@ discard block |
||
1675 | 1675 | } |
1676 | 1676 | break; |
1677 | 1677 | } |
1678 | - $this->DebugMessage('WatermarkText() calling imagestring($img_watermark, ' . $size . ', ' . $x_offset . ', ' . ($key * imagefontheight($size)) . ', ' . $line . ', $text_color_watermark)', __FILE__, __LINE__); |
|
1678 | + $this->DebugMessage('WatermarkText() calling imagestring($img_watermark, '.$size.', '.$x_offset.', '.($key * imagefontheight($size)).', '.$line.', $text_color_watermark)', __FILE__, __LINE__); |
|
1679 | 1679 | imagestring($img_watermark, $size, $x_offset, $key * imagefontheight($size), $line, $text_color_watermark); |
1680 | 1680 | if ($angle && $img_watermark_mask) { |
1681 | - $this->DebugMessage('WatermarkText() calling imagestring($img_watermark_mask, ' . $size . ', ' . $x_offset . ', ' . ($key * imagefontheight($size)) . ', ' . $text . ', $mask_color_watermark)', __FILE__, __LINE__); |
|
1681 | + $this->DebugMessage('WatermarkText() calling imagestring($img_watermark_mask, '.$size.', '.$x_offset.', '.($key * imagefontheight($size)).', '.$text.', $mask_color_watermark)', __FILE__, __LINE__); |
|
1682 | 1682 | imagestring($img_watermark_mask, $size, $x_offset, $key * imagefontheight($size), $text, $mask_color_watermark); |
1683 | 1683 | } |
1684 | 1684 | } |
@@ -1688,8 +1688,8 @@ discard block |
||
1688 | 1688 | self::ApplyMask($img_watermark_mask, $img_watermark); |
1689 | 1689 | } |
1690 | 1690 | //phpthumb_filters::WatermarkOverlay($gdimg, $img_watermark, $alignment, $opacity, $margin); |
1691 | - $this->DebugMessage('WatermarkText() calling phpthumb_filters::WatermarkOverlay($gdimg, $img_watermark, ' . ($originOffsetX . 'x' . $originOffsetY) . ', ' . $opacity . ', 0)', __FILE__, __LINE__); |
|
1692 | - self::WatermarkOverlay($gdimg, $img_watermark, $originOffsetX . 'x' . $originOffsetY, $opacity, 0); |
|
1691 | + $this->DebugMessage('WatermarkText() calling phpthumb_filters::WatermarkOverlay($gdimg, $img_watermark, '.($originOffsetX.'x'.$originOffsetY).', '.$opacity.', 0)', __FILE__, __LINE__); |
|
1692 | + self::WatermarkOverlay($gdimg, $img_watermark, $originOffsetX.'x'.$originOffsetY, $opacity, 0); |
|
1693 | 1693 | imagedestroy($img_watermark); |
1694 | 1694 | |
1695 | 1695 | return true; |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | for ($y = ($imageY - 1); $y >= 0; $y--) { |
70 | 70 | $thisline = ''; |
71 | 71 | for ($x = 0; $x < $imageX; $x++) { |
72 | - $argb = phpthumb_functions::GetPixelColor($gd_image, $x, $y); |
|
73 | - $thisline .= chr($argb['blue']) . chr($argb['green']) . chr($argb['red']); |
|
72 | + $argb = phpthumb_functions::GetPixelColor($gd_image, $x, $y); |
|
73 | + $thisline .= chr($argb['blue']).chr($argb['green']).chr($argb['red']); |
|
74 | 74 | } |
75 | 75 | while (strlen($thisline) % 4) { |
76 | 76 | $thisline .= "\x00"; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $bmpSize = strlen($BMP) + 14 + 40; |
82 | 82 | // BITMAPFILEHEADER [14 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_62uq.asp |
83 | - $BITMAPFILEHEADER = 'BM'; // WORD bfType; |
|
83 | + $BITMAPFILEHEADER = 'BM'; // WORD bfType; |
|
84 | 84 | $BITMAPFILEHEADER .= phpthumb_functions::LittleEndian2String($bmpSize, 4); // DWORD bfSize; |
85 | 85 | $BITMAPFILEHEADER .= phpthumb_functions::LittleEndian2String(0, 2); // WORD bfReserved1; |
86 | 86 | $BITMAPFILEHEADER .= phpthumb_functions::LittleEndian2String(0, 2); // WORD bfReserved2; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String(0, 4); // DWORD biClrUsed; |
100 | 100 | $BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String(0, 4); // DWORD biClrImportant; |
101 | 101 | |
102 | - return $BITMAPFILEHEADER . $BITMAPINFOHEADER . $BMP; |
|
102 | + return $BITMAPFILEHEADER.$BITMAPINFOHEADER.$BMP; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | |
115 | 115 | // shortcuts |
116 | 116 | $ThisFileInfo['bmp']['header']['raw'] = []; |
117 | - $thisfile_bmp =& $ThisFileInfo['bmp']; |
|
118 | - $thisfile_bmp_header =& $thisfile_bmp['header']; |
|
119 | - $thisfile_bmp_header_raw =& $thisfile_bmp_header['raw']; |
|
117 | + $thisfile_bmp = & $ThisFileInfo['bmp']; |
|
118 | + $thisfile_bmp_header = & $thisfile_bmp['header']; |
|
119 | + $thisfile_bmp_header_raw = & $thisfile_bmp_header['raw']; |
|
120 | 120 | |
121 | 121 | // BITMAPFILEHEADER [14 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_62uq.asp |
122 | 122 | // all versions |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | $overalloffset += (14 + 40); |
133 | 133 | |
134 | 134 | $thisfile_bmp_header_raw['identifier'] = substr($BMPheader, $offset, 2); |
135 | - $offset += 2; |
|
135 | + $offset += 2; |
|
136 | 136 | |
137 | 137 | if ('BM' !== $thisfile_bmp_header_raw['identifier']) { |
138 | - $ThisFileInfo['error'][] = 'Expecting "BM" at offset ' . (int)(@$ThisFileInfo['avdataoffset']) . ', found "' . $thisfile_bmp_header_raw['identifier'] . '"'; |
|
138 | + $ThisFileInfo['error'][] = 'Expecting "BM" at offset '.(int)(@$ThisFileInfo['avdataoffset']).', found "'.$thisfile_bmp_header_raw['identifier'].'"'; |
|
139 | 139 | unset($ThisFileInfo['fileformat']); |
140 | 140 | unset($ThisFileInfo['bmp']); |
141 | 141 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | |
210 | 210 | $ThisFileInfo['video']['resolution_x'] = $thisfile_bmp_header_raw['width']; |
211 | 211 | $ThisFileInfo['video']['resolution_y'] = $thisfile_bmp_header_raw['height']; |
212 | - $ThisFileInfo['video']['codec'] = 'BI_RGB ' . $thisfile_bmp_header_raw['bits_per_pixel'] . '-bit'; |
|
212 | + $ThisFileInfo['video']['codec'] = 'BI_RGB '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit'; |
|
213 | 213 | $ThisFileInfo['video']['bits_per_sample'] = $thisfile_bmp_header_raw['bits_per_pixel']; |
214 | 214 | |
215 | 215 | if ($thisfile_bmp['type_version'] >= 2) { |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | |
260 | 260 | $thisfile_bmp_header['compression'] = $this->BMPcompressionOS2Lookup($thisfile_bmp_header_raw['compression']); |
261 | 261 | |
262 | - $ThisFileInfo['video']['codec'] = $thisfile_bmp_header['compression'] . ' ' . $thisfile_bmp_header_raw['bits_per_pixel'] . '-bit'; |
|
262 | + $ThisFileInfo['video']['codec'] = $thisfile_bmp_header['compression'].' '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit'; |
|
263 | 263 | } |
264 | 264 | } elseif ('Windows' === $thisfile_bmp['type_os']) { |
265 | 265 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $thisfile_bmp_header['compression'] = $this->BMPcompressionWindowsLookup($thisfile_bmp_header_raw['compression']); |
304 | 304 | $ThisFileInfo['video']['resolution_x'] = $thisfile_bmp_header_raw['width']; |
305 | 305 | $ThisFileInfo['video']['resolution_y'] = $thisfile_bmp_header_raw['height']; |
306 | - $ThisFileInfo['video']['codec'] = $thisfile_bmp_header['compression'] . ' ' . $thisfile_bmp_header_raw['bits_per_pixel'] . '-bit'; |
|
306 | + $ThisFileInfo['video']['codec'] = $thisfile_bmp_header['compression'].' '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit'; |
|
307 | 307 | $ThisFileInfo['video']['bits_per_sample'] = $thisfile_bmp_header_raw['bits_per_pixel']; |
308 | 308 | |
309 | 309 | if (($thisfile_bmp['type_version'] >= 4) || (3 == $thisfile_bmp_header_raw['compression'])) { |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { |
470 | 470 | for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) { |
471 | 471 | $thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData{$pixeldataoffset + 2}) << 16) | (ord($BMPpixelData{$pixeldataoffset + 1}) << 8) | ord($BMPpixelData{$pixeldataoffset}); |
472 | - $pixeldataoffset += 3; |
|
472 | + $pixeldataoffset += 3; |
|
473 | 473 | } |
474 | 474 | while (0 != ($pixeldataoffset % 4)) { |
475 | 475 | // lines are padded to nearest DWORD |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { |
483 | 483 | for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) { |
484 | 484 | $thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData{$pixeldataoffset + 3}) << 24) | (ord($BMPpixelData{$pixeldataoffset + 2}) << 16) | (ord($BMPpixelData{$pixeldataoffset + 1}) << 8) | ord($BMPpixelData{$pixeldataoffset}); |
485 | - $pixeldataoffset += 4; |
|
485 | + $pixeldataoffset += 4; |
|
486 | 486 | } |
487 | 487 | while (0 != ($pixeldataoffset % 4)) { |
488 | 488 | // lines are padded to nearest DWORD |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | break; |
497 | 497 | |
498 | 498 | default: |
499 | - $ThisFileInfo['error'][] = 'Unknown bits-per-pixel value (' . $thisfile_bmp_header_raw['bits_per_pixel'] . ') - cannot read pixel data'; |
|
499 | + $ThisFileInfo['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data'; |
|
500 | 500 | break; |
501 | 501 | } |
502 | 502 | break; |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | break; |
569 | 569 | |
570 | 570 | default: |
571 | - $ThisFileInfo['error'][] = 'Unknown bits-per-pixel value (' . $thisfile_bmp_header_raw['bits_per_pixel'] . ') - cannot read pixel data'; |
|
571 | + $ThisFileInfo['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data'; |
|
572 | 572 | break; |
573 | 573 | } |
574 | 574 | break; |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | break; |
654 | 654 | |
655 | 655 | default: |
656 | - $ThisFileInfo['error'][] = 'Unknown bits-per-pixel value (' . $thisfile_bmp_header_raw['bits_per_pixel'] . ') - cannot read pixel data'; |
|
656 | + $ThisFileInfo['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data'; |
|
657 | 657 | break; |
658 | 658 | } |
659 | 659 | break; |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | } |
683 | 683 | for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { |
684 | 684 | for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) { |
685 | - $pixelvalue = $this->LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset, $thisfile_bmp_header_raw['bits_per_pixel'] / 8)); |
|
685 | + $pixelvalue = $this->LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset, $thisfile_bmp_header_raw['bits_per_pixel'] / 8)); |
|
686 | 686 | $pixeldataoffset += $thisfile_bmp_header_raw['bits_per_pixel'] / 8; |
687 | 687 | |
688 | 688 | $red = (int)round(((($pixelvalue & $thisfile_bmp_header_raw['red_mask']) >> $redshift) / ($thisfile_bmp_header_raw['red_mask'] >> $redshift)) * 255); |
@@ -698,13 +698,13 @@ discard block |
||
698 | 698 | break; |
699 | 699 | |
700 | 700 | default: |
701 | - $ThisFileInfo['error'][] = 'Unknown bits-per-pixel value (' . $thisfile_bmp_header_raw['bits_per_pixel'] . ') - cannot read pixel data'; |
|
701 | + $ThisFileInfo['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data'; |
|
702 | 702 | break; |
703 | 703 | } |
704 | 704 | break; |
705 | 705 | |
706 | 706 | default: // unhandled compression type |
707 | - $ThisFileInfo['error'][] = 'Unknown/unhandled compression type value (' . $thisfile_bmp_header_raw['compression'] . ') - cannot decompress pixel data'; |
|
707 | + $ThisFileInfo['error'][] = 'Unknown/unhandled compression type value ('.$thisfile_bmp_header_raw['compression'].') - cannot decompress pixel data'; |
|
708 | 708 | break; |
709 | 709 | } |
710 | 710 | } |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | } |
796 | 796 | $im = $this->PlotPixelsGD($BMPinfo['bmp']); |
797 | 797 | if (headers_sent()) { |
798 | - echo 'plotted ' . ($BMPinfo['resolution_x'] * $BMPinfo['resolution_y']) . ' pixels in ' . (time() - $starttime) . ' seconds<BR>'; |
|
798 | + echo 'plotted '.($BMPinfo['resolution_x'] * $BMPinfo['resolution_y']).' pixels in '.(time() - $starttime).' seconds<BR>'; |
|
799 | 799 | imagedestroy($im); |
800 | 800 | exit; |
801 | 801 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | return escapeshellarg($arg); |
163 | 163 | } |
164 | 164 | |
165 | - return '\'' . str_replace('\'', '\\\'', $arg) . '\''; |
|
165 | + return '\''.str_replace('\'', '\\\'', $arg).'\''; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | if (empty($exif_info)) { |
192 | 192 | // based on code by johnschaefer at gmx dot de |
193 | 193 | // from PHP help on gd_info() |
194 | - $exif_info = [ |
|
194 | + $exif_info = [ |
|
195 | 195 | 'EXIF Support' => '', |
196 | 196 | 'EXIF Version' => '', |
197 | 197 | 'Supported EXIF Version' => '', |
@@ -223,28 +223,28 @@ discard block |
||
223 | 223 | return image_type_to_mime_type($imagetype); |
224 | 224 | } |
225 | 225 | static $image_type_to_mime_type = [ |
226 | - 1 => 'image/gif', // IMAGETYPE_GIF |
|
227 | - 2 => 'image/jpeg', // IMAGETYPE_JPEG |
|
228 | - 3 => 'image/png', // IMAGETYPE_PNG |
|
226 | + 1 => 'image/gif', // IMAGETYPE_GIF |
|
227 | + 2 => 'image/jpeg', // IMAGETYPE_JPEG |
|
228 | + 3 => 'image/png', // IMAGETYPE_PNG |
|
229 | 229 | 4 => 'application/x-shockwave-flash', // IMAGETYPE_SWF |
230 | - 5 => 'image/psd', // IMAGETYPE_PSD |
|
231 | - 6 => 'image/bmp', // IMAGETYPE_BMP |
|
232 | - 7 => 'image/tiff', // IMAGETYPE_TIFF_II (intel byte order) |
|
233 | - 8 => 'image/tiff', // IMAGETYPE_TIFF_MM (motorola byte order) |
|
234 | - 9 => 'application/octet-stream', // IMAGETYPE_JPC |
|
235 | - 10 => 'image/jp2', // IMAGETYPE_JP2 |
|
236 | - 11 => 'application/octet-stream', // IMAGETYPE_JPX |
|
237 | - 12 => 'application/octet-stream', // IMAGETYPE_JB2 |
|
230 | + 5 => 'image/psd', // IMAGETYPE_PSD |
|
231 | + 6 => 'image/bmp', // IMAGETYPE_BMP |
|
232 | + 7 => 'image/tiff', // IMAGETYPE_TIFF_II (intel byte order) |
|
233 | + 8 => 'image/tiff', // IMAGETYPE_TIFF_MM (motorola byte order) |
|
234 | + 9 => 'application/octet-stream', // IMAGETYPE_JPC |
|
235 | + 10 => 'image/jp2', // IMAGETYPE_JP2 |
|
236 | + 11 => 'application/octet-stream', // IMAGETYPE_JPX |
|
237 | + 12 => 'application/octet-stream', // IMAGETYPE_JB2 |
|
238 | 238 | 13 => 'application/x-shockwave-flash', // IMAGETYPE_SWC |
239 | - 14 => 'image/iff', // IMAGETYPE_IFF |
|
240 | - 15 => 'image/vnd.wap.wbmp', // IMAGETYPE_WBMP |
|
241 | - 16 => 'image/xbm', // IMAGETYPE_XBM |
|
242 | - |
|
243 | - 'gif' => 'image/gif', // IMAGETYPE_GIF |
|
244 | - 'jpg' => 'image/jpeg', // IMAGETYPE_JPEG |
|
245 | - 'jpeg' => 'image/jpeg', // IMAGETYPE_JPEG |
|
246 | - 'png' => 'image/png', // IMAGETYPE_PNG |
|
247 | - 'bmp' => 'image/bmp', // IMAGETYPE_BMP |
|
239 | + 14 => 'image/iff', // IMAGETYPE_IFF |
|
240 | + 15 => 'image/vnd.wap.wbmp', // IMAGETYPE_WBMP |
|
241 | + 16 => 'image/xbm', // IMAGETYPE_XBM |
|
242 | + |
|
243 | + 'gif' => 'image/gif', // IMAGETYPE_GIF |
|
244 | + 'jpg' => 'image/jpeg', // IMAGETYPE_JPEG |
|
245 | + 'jpeg' => 'image/jpeg', // IMAGETYPE_JPEG |
|
246 | + 'png' => 'image/png', // IMAGETYPE_PNG |
|
247 | + 'bmp' => 'image/bmp', // IMAGETYPE_BMP |
|
248 | 248 | 'ico' => 'image/x-icon', |
249 | 249 | ]; |
250 | 250 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $len = strlen($string); |
278 | 278 | $output = ''; |
279 | 279 | for ($i = 0; $i < $len; $i++) { |
280 | - $output .= ' 0x' . str_pad(dechex(ord($string{$i})), 2, '0', STR_PAD_LEFT); |
|
280 | + $output .= ' 0x'.str_pad(dechex(ord($string{$i})), 2, '0', STR_PAD_LEFT); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | return $output; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | return self::ImageColorAllocateAlphaSafe($gdimg_hexcolorallocate, $R, $G, $B, $alpha); |
334 | 334 | } |
335 | 335 | if ($dieOnInvalid) { |
336 | - die('Invalid hex color string: "' . $HexColorString . '"'); |
|
336 | + die('Invalid hex color string: "'.$HexColorString.'"'); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | return imagecolorallocate($gdimg_hexcolorallocate, 0x00, 0x00, 0x00); |
@@ -535,10 +535,10 @@ discard block |
||
535 | 535 | $ImageCreateFunction = 'imagecreatetruecolor'; |
536 | 536 | } |
537 | 537 | if (!function_exists($ImageCreateFunction)) { |
538 | - return phpthumb::ErrorImage($ImageCreateFunction . '() does not exist - no GD support?'); |
|
538 | + return phpthumb::ErrorImage($ImageCreateFunction.'() does not exist - no GD support?'); |
|
539 | 539 | } |
540 | 540 | if (($x_size <= 0) || ($y_size <= 0)) { |
541 | - return phpthumb::ErrorImage('Invalid image dimensions: ' . $ImageCreateFunction . '(' . $x_size . ', ' . $y_size . ')'); |
|
541 | + return phpthumb::ErrorImage('Invalid image dimensions: '.$ImageCreateFunction.'('.$x_size.', '.$y_size.')'); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | return $ImageCreateFunction(round($x_size), round($y_size)); |
@@ -762,10 +762,10 @@ discard block |
||
762 | 762 | if (empty($cache_gd_version)) { |
763 | 763 | $gd_info = gd_info(); |
764 | 764 | if (preg_match('#bundled \((.+)\)$#i', $gd_info['GD Version'], $matches)) { |
765 | - $cache_gd_version[1] = $gd_info['GD Version']; // e.g. "bundled (2.0.15 compatible)" |
|
766 | - $cache_gd_version[0] = (float)$matches[1]; // e.g. "2.0" (not "bundled (2.0.15 compatible)") |
|
765 | + $cache_gd_version[1] = $gd_info['GD Version']; // e.g. "bundled (2.0.15 compatible)" |
|
766 | + $cache_gd_version[0] = (float)$matches[1]; // e.g. "2.0" (not "bundled (2.0.15 compatible)") |
|
767 | 767 | } else { |
768 | - $cache_gd_version[1] = $gd_info['GD Version']; // e.g. "1.6.2 or higher" |
|
768 | + $cache_gd_version[1] = $gd_info['GD Version']; // e.g. "1.6.2 or higher" |
|
769 | 769 | $cache_gd_version[0] = (float)substr($gd_info['GD Version'], 0, 3); // e.g. "1.6" (not "1.6.2 or higher") |
770 | 770 | } |
771 | 771 | } |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | $size = false; |
784 | 784 | $url = self::ParseURLbetter($remotefile); |
785 | 785 | if ($fp = @fsockopen($url['host'], ($url['port'] ?: 80), $errno, $errstr, $timeout)) { |
786 | - fwrite($fp, 'HEAD ' . @$url['path'] . @$url['query'] . ' HTTP/1.0' . "\r\n" . 'Host: ' . @$url['host'] . "\r\n\r\n"); |
|
786 | + fwrite($fp, 'HEAD '.@$url['path'].@$url['query'].' HTTP/1.0'."\r\n".'Host: '.@$url['host']."\r\n\r\n"); |
|
787 | 787 | if (self::version_compare_replacement(PHP_VERSION, '4.3.0', '>=')) { |
788 | 788 | stream_set_timeout($fp, $timeout); |
789 | 789 | } |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | $date = false; |
811 | 811 | $url = self::ParseURLbetter($remotefile); |
812 | 812 | if ($fp = @fsockopen($url['host'], ($url['port'] ?: 80), $errno, $errstr, $timeout)) { |
813 | - fwrite($fp, 'HEAD ' . @$url['path'] . @$url['query'] . ' HTTP/1.0' . "\r\n" . 'Host: ' . @$url['host'] . "\r\n\r\n"); |
|
813 | + fwrite($fp, 'HEAD '.@$url['path'].@$url['query'].' HTTP/1.0'."\r\n".'Host: '.@$url['host']."\r\n\r\n"); |
|
814 | 814 | if (self::version_compare_replacement(PHP_VERSION, '4.3.0', '>=')) { |
815 | 815 | stream_set_timeout($fp, $timeout); |
816 | 816 | } |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | if ($fp = @fopen($filename, 'rb')) { |
841 | 841 | $rawData = ''; |
842 | 842 | do { |
843 | - $buffer = fread($fp, 8192); |
|
843 | + $buffer = fread($fp, 8192); |
|
844 | 844 | $rawData .= $buffer; |
845 | 845 | } while (strlen($buffer) > 0); |
846 | 846 | fclose($fp); |
@@ -876,8 +876,8 @@ discard block |
||
876 | 876 | { |
877 | 877 | $intstring = ''; |
878 | 878 | while ($number > 0) { |
879 | - $intstring = $intstring . chr($number & 255); |
|
880 | - $number >>= 8; |
|
879 | + $intstring = $intstring.chr($number & 255); |
|
880 | + $number >>= 8; |
|
881 | 881 | } |
882 | 882 | |
883 | 883 | return str_pad($intstring, $minbytes, "\x00", STR_PAD_RIGHT); |
@@ -935,10 +935,10 @@ discard block |
||
935 | 935 | return false; |
936 | 936 | } |
937 | 937 | //if ($fp = @fsockopen($host, $port, $errno, $errstr, $timeout)) { |
938 | - if ($fp = @fsockopen(((443 == $port) ? 'ssl://' : '') . $host, $port, $errno, $errstr, $timeout)) { // https://github.com/JamesHeinrich/phpThumb/issues/39 |
|
939 | - $out = 'GET ' . $file . ' HTTP/1.0' . "\r\n"; |
|
940 | - $out .= 'Host: ' . $host . "\r\n"; |
|
941 | - $out .= 'Connection: Close' . "\r\n\r\n"; |
|
938 | + if ($fp = @fsockopen(((443 == $port) ? 'ssl://' : '').$host, $port, $errno, $errstr, $timeout)) { // https://github.com/JamesHeinrich/phpThumb/issues/39 |
|
939 | + $out = 'GET '.$file.' HTTP/1.0'."\r\n"; |
|
940 | + $out .= 'Host: '.$host."\r\n"; |
|
941 | + $out .= 'Connection: Close'."\r\n\r\n"; |
|
942 | 942 | fwrite($fp, $out); |
943 | 943 | |
944 | 944 | $isHeader = true; |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | break; |
968 | 968 | |
969 | 969 | default: |
970 | - $errstr = $errno . ' ' . $errstr . ($header_newlocation ? '; Location: ' . $header_newlocation : ''); |
|
970 | + $errstr = $errno.' '.$errstr.($header_newlocation ? '; Location: '.$header_newlocation : ''); |
|
971 | 971 | fclose($fp); |
972 | 972 | |
973 | 973 | return false; |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | $CleanQueries = []; |
1012 | 1012 | foreach ($queries as $key => $query) { |
1013 | 1013 | @list($param, $value) = explode('=', $query); |
1014 | - $CleanQueries[] = strtr($param, $TranslationMatrix) . ($value ? '=' . strtr($value, $TranslationMatrix) : ''); |
|
1014 | + $CleanQueries[] = strtr($param, $TranslationMatrix).($value ? '='.strtr($value, $TranslationMatrix) : ''); |
|
1015 | 1015 | } |
1016 | 1016 | foreach ($CleanQueries as $key => $value) { |
1017 | 1017 | if ('' === $value) { |
@@ -1019,12 +1019,12 @@ discard block |
||
1019 | 1019 | } |
1020 | 1020 | } |
1021 | 1021 | |
1022 | - $cleaned_url = $parse_url['scheme'] . '://'; |
|
1023 | - $cleaned_url .= (@$parse_url['username'] ? $parse_url['host'] . (@$parse_url['password'] ? ':' . $parse_url['password'] : '') . '@' : ''); |
|
1022 | + $cleaned_url = $parse_url['scheme'].'://'; |
|
1023 | + $cleaned_url .= (@$parse_url['username'] ? $parse_url['host'].(@$parse_url['password'] ? ':'.$parse_url['password'] : '').'@' : ''); |
|
1024 | 1024 | $cleaned_url .= $parse_url['host']; |
1025 | - $cleaned_url .= ((!empty($parse_url['port']) && (80 != $parse_url['port'])) ? ':' . $parse_url['port'] : ''); |
|
1026 | - $cleaned_url .= '/' . implode('/', $CleanPathElements); |
|
1027 | - $cleaned_url .= (@$CleanQueries ? '?' . implode($queryseperator, $CleanQueries) : ''); |
|
1025 | + $cleaned_url .= ((!empty($parse_url['port']) && (80 != $parse_url['port'])) ? ':'.$parse_url['port'] : ''); |
|
1026 | + $cleaned_url .= '/'.implode('/', $CleanPathElements); |
|
1027 | + $cleaned_url .= (@$CleanQueries ? '?'.implode($queryseperator, $CleanQueries) : ''); |
|
1028 | 1028 | |
1029 | 1029 | return $cleaned_url; |
1030 | 1030 | } |
@@ -1071,12 +1071,12 @@ discard block |
||
1071 | 1071 | |
1072 | 1072 | while (true) { |
1073 | 1073 | $tryagain = false; |
1074 | - $rawData = self::URLreadFsock(@$parsed_url['host'], @$parsed_url['path'] . '?' . @$parsed_url['query'], $errstr, true, (@$parsed_url['port'] ?: 80), $timeout); |
|
1074 | + $rawData = self::URLreadFsock(@$parsed_url['host'], @$parsed_url['path'].'?'.@$parsed_url['query'], $errstr, true, (@$parsed_url['port'] ?: 80), $timeout); |
|
1075 | 1075 | if ($followredirects && preg_match('#302 [a-z ]+; Location\\: (http.*)#i', $errstr, $matches)) { |
1076 | 1076 | $matches[1] = trim(@$matches[1]); |
1077 | 1077 | if (!@$alreadyLookedAtURLs[$matches[1]]) { |
1078 | 1078 | // loop through and examine new URL |
1079 | - $error .= 'URL "' . $url . '" redirected to "' . $matches[1] . '"'; |
|
1079 | + $error .= 'URL "'.$url.'" redirected to "'.$matches[1].'"'; |
|
1080 | 1080 | |
1081 | 1081 | $tryagain = true; |
1082 | 1082 | $alreadyLookedAtURLs[$matches[1]] = true; |
@@ -1089,12 +1089,12 @@ discard block |
||
1089 | 1089 | } |
1090 | 1090 | |
1091 | 1091 | if (false === $rawData) { |
1092 | - $error .= 'Error opening "' . $url . '":' . "\n\n" . $errstr; |
|
1092 | + $error .= 'Error opening "'.$url.'":'."\n\n".$errstr; |
|
1093 | 1093 | |
1094 | 1094 | return false; |
1095 | 1095 | } elseif (null === $rawData) { |
1096 | 1096 | // fall through |
1097 | - $error .= 'Error opening "' . $url . '":' . "\n\n" . $errstr; |
|
1097 | + $error .= 'Error opening "'.$url.'":'."\n\n".$errstr; |
|
1098 | 1098 | } else { |
1099 | 1099 | return $rawData; |
1100 | 1100 | } |
@@ -1105,14 +1105,14 @@ discard block |
||
1105 | 1105 | curl_setopt($ch, CURLOPT_HEADER, false); |
1106 | 1106 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
1107 | 1107 | curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); |
1108 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // changed for XOOPS |
|
1108 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // changed for XOOPS |
|
1109 | 1109 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); // changed for XOOPS |
1110 | 1110 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, (bool)$followredirects); |
1111 | 1111 | curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
1112 | 1112 | $rawData = curl_exec($ch); |
1113 | 1113 | curl_close($ch); |
1114 | 1114 | if (strlen($rawData) > 0) { |
1115 | - $error .= 'CURL succeeded (' . strlen($rawData) . ' bytes); '; |
|
1115 | + $error .= 'CURL succeeded ('.strlen($rawData).' bytes); '; |
|
1116 | 1116 | |
1117 | 1117 | return $rawData; |
1118 | 1118 | } |
@@ -1123,14 +1123,14 @@ discard block |
||
1123 | 1123 | |
1124 | 1124 | $BrokenURLfopenPHPversions = ['4.4.2']; |
1125 | 1125 | if (in_array(PHP_VERSION, $BrokenURLfopenPHPversions)) { |
1126 | - $error .= 'fopen(URL) broken in PHP v' . PHP_VERSION . '; '; |
|
1126 | + $error .= 'fopen(URL) broken in PHP v'.PHP_VERSION.'; '; |
|
1127 | 1127 | } elseif (@ini_get('allow_url_fopen')) { |
1128 | 1128 | $rawData = ''; |
1129 | 1129 | $error_fopen = ''; |
1130 | 1130 | ob_start(); |
1131 | 1131 | if ($fp = fopen($url, 'rb')) { |
1132 | 1132 | do { |
1133 | - $buffer = fread($fp, 8192); |
|
1133 | + $buffer = fread($fp, 8192); |
|
1134 | 1134 | $rawData .= $buffer; |
1135 | 1135 | } while (strlen($buffer) > 0); |
1136 | 1136 | fclose($fp); |
@@ -1140,11 +1140,11 @@ discard block |
||
1140 | 1140 | ob_end_clean(); |
1141 | 1141 | $error .= $error_fopen; |
1142 | 1142 | if (!$error_fopen) { |
1143 | - $error .= '; "allow_url_fopen" succeeded (' . strlen($rawData) . ' bytes); '; |
|
1143 | + $error .= '; "allow_url_fopen" succeeded ('.strlen($rawData).' bytes); '; |
|
1144 | 1144 | |
1145 | 1145 | return $rawData; |
1146 | 1146 | } |
1147 | - $error .= '; "allow_url_fopen" enabled but returned no data (' . $error_fopen . '); '; |
|
1147 | + $error .= '; "allow_url_fopen" enabled but returned no data ('.$error_fopen.'); '; |
|
1148 | 1148 | } else { |
1149 | 1149 | $error .= '"allow_url_fopen" disabled; '; |
1150 | 1150 | } |
@@ -1159,10 +1159,10 @@ discard block |
||
1159 | 1159 | public static function EnsureDirectoryExists($dirname) |
1160 | 1160 | { |
1161 | 1161 | $directory_elements = explode(DIRECTORY_SEPARATOR, $dirname); |
1162 | - $startoffset = (!$directory_elements[0] ? 2 : 1); // unix with leading "/" then start with 2nd element; Windows with leading "c:\" then start with 1st element |
|
1162 | + $startoffset = (!$directory_elements[0] ? 2 : 1); // unix with leading "/" then start with 2nd element; Windows with leading "c:\" then start with 1st element |
|
1163 | 1163 | $open_basedirs = preg_split('#[;:]#', ini_get('open_basedir')); |
1164 | 1164 | foreach ($open_basedirs as $key => $open_basedir) { |
1165 | - if (preg_match('#^' . preg_quote($open_basedir) . '#', $dirname) |
|
1165 | + if (preg_match('#^'.preg_quote($open_basedir).'#', $dirname) |
|
1166 | 1166 | && (strlen($dirname) > strlen($open_basedir))) { |
1167 | 1167 | $startoffset = substr_count($open_basedir, DIRECTORY_SEPARATOR) + 1; |
1168 | 1168 | break; |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | $dirname = rtrim(realpath($dirname), '/\\'); |
1202 | 1202 | if ($dirhandle = @opendir($dirname)) { |
1203 | 1203 | while (false !== ($file = readdir($dirhandle))) { |
1204 | - $fullfilename = $dirname . DIRECTORY_SEPARATOR . $file; |
|
1204 | + $fullfilename = $dirname.DIRECTORY_SEPARATOR.$file; |
|
1205 | 1205 | if (is_file($fullfilename)) { |
1206 | 1206 | $AllFiles[] = $fullfilename; |
1207 | 1207 | } elseif (is_dir($fullfilename)) { |
@@ -1235,7 +1235,7 @@ discard block |
||
1235 | 1235 | */ |
1236 | 1236 | public static function SanitizeFilename($filename) |
1237 | 1237 | { |
1238 | - $filename = preg_replace('/[^' . preg_quote(' !#$%^()+,-.;<>=@[]_{}') . 'a-zA-Z0-9]/', '_', $filename); |
|
1238 | + $filename = preg_replace('/[^'.preg_quote(' !#$%^()+,-.;<>=@[]_{}').'a-zA-Z0-9]/', '_', $filename); |
|
1239 | 1239 | if (self::version_compare_replacement(PHP_VERSION, '4.1.0', '>=')) { |
1240 | 1240 | $filename = trim($filename, '.'); |
1241 | 1241 | } |
@@ -1272,7 +1272,7 @@ discard block |
||
1272 | 1272 | if (empty($gd_info)) { |
1273 | 1273 | // based on code by johnschaefer at gmx dot de |
1274 | 1274 | // from PHP help on gd_info() |
1275 | - $gd_info = [ |
|
1275 | + $gd_info = [ |
|
1276 | 1276 | 'GD Version' => '', |
1277 | 1277 | 'FreeType Support' => false, |
1278 | 1278 | 'FreeType Linkage' => '', |
@@ -1363,7 +1363,7 @@ discard block |
||
1363 | 1363 | if (empty($preg_quote_array)) { |
1364 | 1364 | $escapeables = '.\\+*?[^]$(){}=!<>|:'; |
1365 | 1365 | for ($i = 0; $i < strlen($escapeables); $i++) { |
1366 | - $strtr_preg_quote[$escapeables{$i}] = $delimiter . $escapeables{$i}; |
|
1366 | + $strtr_preg_quote[$escapeables{$i}] = $delimiter.$escapeables{$i}; |
|
1367 | 1367 | } |
1368 | 1368 | } |
1369 | 1369 | |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | if ($fp = @fopen($filename, 'rb')) { |
1386 | 1386 | $rawData = ''; |
1387 | 1387 | do { |
1388 | - $buffer = fread($fp, 8192); |
|
1388 | + $buffer = fread($fp, 8192); |
|
1389 | 1389 | $rawData .= $buffer; |
1390 | 1390 | } while (strlen($buffer) > 0); |
1391 | 1391 | fclose($fp); |
@@ -1588,10 +1588,10 @@ discard block |
||
1588 | 1588 | $this->DebugMessage('using ImageMagick path from $this->config_imagemagick_path (' . $this->config_imagemagick_path . ')', __FILE__, __LINE__); |
1589 | 1589 | if ($this->iswindows) { |
1590 | 1590 | $commandline = substr($this->config_imagemagick_path, 0, 2) |
1591 | - . ' && cd ' |
|
1592 | - . phpthumb_functions::escapeshellarg_replacement(str_replace('/', DIRECTORY_SEPARATOR, substr(dirname($this->config_imagemagick_path), 2))) |
|
1593 | - . ' && ' |
|
1594 | - . phpthumb_functions::escapeshellarg_replacement(basename($this->config_imagemagick_path)); |
|
1591 | + . ' && cd ' |
|
1592 | + . phpthumb_functions::escapeshellarg_replacement(str_replace('/', DIRECTORY_SEPARATOR, substr(dirname($this->config_imagemagick_path), 2))) |
|
1593 | + . ' && ' |
|
1594 | + . phpthumb_functions::escapeshellarg_replacement(basename($this->config_imagemagick_path)); |
|
1595 | 1595 | } else { |
1596 | 1596 | $commandline = phpthumb_functions::escapeshellarg_replacement($this->config_imagemagick_path); |
1597 | 1597 | } |
@@ -2204,9 +2204,9 @@ discard block |
||
2204 | 2204 | |
2205 | 2205 | if (($method > 1) |
2206 | 2206 | && !$this->ImageMagickSwitchAvailable([ |
2207 | - 'channel', |
|
2208 | - 'contrast-stretch' |
|
2209 | - ])) { |
|
2207 | + 'channel', |
|
2208 | + 'contrast-stretch' |
|
2209 | + ])) { |
|
2210 | 2210 | // Because ImageMagick processing happens before PHP-GD filters, and because some |
2211 | 2211 | // clipping is involved in the "lvl" filter, if "lvl" happens before "wb" then the |
2212 | 2212 | // "wb" filter will have (almost) no effect. Therefore, if "wb" is enabled then |
@@ -2311,11 +2311,11 @@ discard block |
||
2311 | 2311 | |
2312 | 2312 | case 'bord': |
2313 | 2313 | if ($this->ImageMagickSwitchAvailable([ |
2314 | - 'border', |
|
2315 | - 'bordercolor', |
|
2316 | - 'thumbnail', |
|
2317 | - 'crop' |
|
2318 | - ])) { |
|
2314 | + 'border', |
|
2315 | + 'bordercolor', |
|
2316 | + 'thumbnail', |
|
2317 | + 'crop' |
|
2318 | + ])) { |
|
2319 | 2319 | if (!$this->zc) { |
2320 | 2320 | @list($width, $rX, $rY, $color) = explode('|', $parameter); |
2321 | 2321 | $width = (int)$width; |
@@ -2335,7 +2335,7 @@ discard block |
||
2335 | 2335 | $commandline = str_replace( |
2336 | 2336 | ' -' . $IMresizeParameter . ' "' . $matches[1] . 'x' . $matches[2] . '" ', |
2337 | 2337 | ' -' . $IMresizeParameter . ' ' . phpthumb_functions::escapeshellarg_replacement(($matches[1] - (2 * $width)) . 'x' . ($matches[2] - (2 * $width))) . ' ', |
2338 | - $commandline |
|
2338 | + $commandline |
|
2339 | 2339 | ); |
2340 | 2340 | } |
2341 | 2341 | $successfullyProcessedFilters[] = $filterkey; |
@@ -3976,16 +3976,16 @@ discard block |
||
3976 | 3976 | $memory_get_usage = (function_exists('memory_get_usage') ? memory_get_usage() : 0); |
3977 | 3977 | |
3978 | 3978 | return $this->ErrorImage('Source image is too large (' |
3979 | - . $this->source_width |
|
3980 | - . 'x' |
|
3981 | - . $this->source_height |
|
3982 | - . ' = ' |
|
3983 | - . number_format($this->source_width * $this->source_height / 1000000, 1) |
|
3984 | - . 'Mpx, max=' |
|
3985 | - . number_format($this->config_max_source_pixels / 1000000, 1) |
|
3986 | - . 'Mpx) for GD creation (either install ImageMagick or increase PHP memory_limit to at least ' |
|
3987 | - . ceil(($memory_get_usage + (5 * $this->source_width * $this->source_height)) / 1048576) |
|
3988 | - . 'M).'); |
|
3979 | + . $this->source_width |
|
3980 | + . 'x' |
|
3981 | + . $this->source_height |
|
3982 | + . ' = ' |
|
3983 | + . number_format($this->source_width * $this->source_height / 1000000, 1) |
|
3984 | + . 'Mpx, max=' |
|
3985 | + . number_format($this->config_max_source_pixels / 1000000, 1) |
|
3986 | + . 'Mpx) for GD creation (either install ImageMagick or increase PHP memory_limit to at least ' |
|
3987 | + . ceil(($memory_get_usage + (5 * $this->source_width * $this->source_height)) / 1048576) |
|
3988 | + . 'M).'); |
|
3989 | 3989 | } |
3990 | 3990 | if ($this->md5s && ($this->md5s != md5($this->rawImageData))) { |
3991 | 3991 | return $this->ErrorImage('$this->md5s != md5($this->rawImageData)' . "\n" . '"' . $this->md5s . '" != ' . "\n" . '"' . md5($this->rawImageData) . '"'); |
@@ -4135,8 +4135,8 @@ discard block |
||
4135 | 4135 | $this->ErrorImage(implode("\n", $errormessages)); |
4136 | 4136 | } else { |
4137 | 4137 | $this->DebugMessage('All attempts to create GD image source failed (' . (ini_get('safe_mode') ? 'Safe Mode enabled, ImageMagick unavailable and source image probably too large for GD' : ($GDreadSupport ? 'source image probably corrupt' : 'GD does not have read support for "' |
4138 | - . $imageHeader |
|
4139 | - . '"')) . '), cannot generate thumbnail'); |
|
4138 | + . $imageHeader |
|
4139 | + . '"')) . '), cannot generate thumbnail'); |
|
4140 | 4140 | //$this->DebugMessage('All attempts to create GD image source failed ('.($GDreadSupport ? 'source image probably corrupt' : 'GD does not have read support for "'.$imageHeader.'"').'), outputing raw image', __FILE__, __LINE__); |
4141 | 4141 | //if (!$this->phpThumbDebug) { |
4142 | 4142 | // header($imageHeader); |
@@ -4545,12 +4545,12 @@ discard block |
||
4545 | 4545 | $height = ($height ?: $this->config_error_image_height); |
4546 | 4546 | |
4547 | 4547 | $text = 'phpThumb() v' . $this->phpthumb_version . "\n" . 'http://phpthumb.sourceforge.net' . "\n\n" . ($this->config_disable_debug ? 'Error messages disabled.' |
4548 | - . "\n\n" |
|
4549 | - . 'edit phpThumb.config.php and (temporarily) set' |
|
4550 | - . "\n" |
|
4551 | - . '$PHPTHUMB_CONFIG[\'disable_debug\'] = false;' |
|
4552 | - . "\n" |
|
4553 | - . 'to view the details of this error' : $text); |
|
4548 | + . "\n\n" |
|
4549 | + . 'edit phpThumb.config.php and (temporarily) set' |
|
4550 | + . "\n" |
|
4551 | + . '$PHPTHUMB_CONFIG[\'disable_debug\'] = false;' |
|
4552 | + . "\n" |
|
4553 | + . 'to view the details of this error' : $text); |
|
4554 | 4554 | |
4555 | 4555 | $this->FatalError($text); |
4556 | 4556 | $this->DebugMessage($text, __FILE__, __LINE__); |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | ////////////////////////////////////////////////////////////// |
11 | 11 | |
12 | 12 | ob_start(); |
13 | -if (!require_once __DIR__ . '/phpthumb.functions.php') { |
|
13 | +if (!require_once __DIR__.'/phpthumb.functions.php') { |
|
14 | 14 | ob_end_flush(); |
15 | - die('failed to include_once("' . __DIR__ . '/phpthumb.functions.php")'); |
|
15 | + die('failed to include_once("'.__DIR__.'/phpthumb.functions.php")'); |
|
16 | 16 | } |
17 | 17 | ob_end_clean(); |
18 | 18 | |
@@ -25,42 +25,42 @@ discard block |
||
25 | 25 | // public: |
26 | 26 | // START PARAMETERS (for object mode and phpThumb.php) |
27 | 27 | // See phpthumb.readme.txt for descriptions of what each of these values are |
28 | - public $src = null; // SouRCe filename |
|
29 | - public $new = null; // NEW image (phpThumb.php only) |
|
30 | - public $w = null; // Width |
|
31 | - public $h = null; // Height |
|
32 | - public $wp = null; // Width (Portrait Images Only) |
|
33 | - public $hp = null; // Height (Portrait Images Only) |
|
34 | - public $wl = null; // Width (Landscape Images Only) |
|
35 | - public $hl = null; // Height (Landscape Images Only) |
|
36 | - public $ws = null; // Width (Square Images Only) |
|
37 | - public $hs = null; // Height (Square Images Only) |
|
38 | - public $f = null; // output image Format |
|
39 | - public $q = 75; // jpeg output Quality |
|
40 | - public $sx = null; // Source crop top-left X position |
|
41 | - public $sy = null; // Source crop top-left Y position |
|
42 | - public $sw = null; // Source crop Width |
|
43 | - public $sh = null; // Source crop Height |
|
44 | - public $zc = null; // Zoom Crop |
|
45 | - public $bc = null; // Border Color |
|
46 | - public $bg = null; // BackGround color |
|
47 | - public $fltr = []; // FiLTeRs |
|
48 | - public $goto = null; // GO TO url after processing |
|
49 | - public $err = null; // default ERRor image filename |
|
50 | - public $xto = null; // extract eXif Thumbnail Only |
|
51 | - public $ra = null; // Rotate by Angle |
|
52 | - public $ar = null; // Auto Rotate |
|
53 | - public $aoe = null; // Allow Output Enlargement |
|
54 | - public $far = null; // Fixed Aspect Ratio |
|
55 | - public $iar = null; // Ignore Aspect Ratio |
|
56 | - public $maxb = null; // MAXimum Bytes |
|
57 | - public $down = null; // DOWNload thumbnail filename |
|
58 | - public $md5s = null; // MD5 hash of Source image |
|
59 | - public $sfn = 0; // Source Frame Number |
|
60 | - public $dpi = 150; // Dots Per Inch for vector source formats |
|
61 | - public $sia = null; // Save Image As filename |
|
62 | - |
|
63 | - public $file = null; // >>>deprecated, DO NOT USE, will be removed in future versions<<< |
|
28 | + public $src = null; // SouRCe filename |
|
29 | + public $new = null; // NEW image (phpThumb.php only) |
|
30 | + public $w = null; // Width |
|
31 | + public $h = null; // Height |
|
32 | + public $wp = null; // Width (Portrait Images Only) |
|
33 | + public $hp = null; // Height (Portrait Images Only) |
|
34 | + public $wl = null; // Width (Landscape Images Only) |
|
35 | + public $hl = null; // Height (Landscape Images Only) |
|
36 | + public $ws = null; // Width (Square Images Only) |
|
37 | + public $hs = null; // Height (Square Images Only) |
|
38 | + public $f = null; // output image Format |
|
39 | + public $q = 75; // jpeg output Quality |
|
40 | + public $sx = null; // Source crop top-left X position |
|
41 | + public $sy = null; // Source crop top-left Y position |
|
42 | + public $sw = null; // Source crop Width |
|
43 | + public $sh = null; // Source crop Height |
|
44 | + public $zc = null; // Zoom Crop |
|
45 | + public $bc = null; // Border Color |
|
46 | + public $bg = null; // BackGround color |
|
47 | + public $fltr = []; // FiLTeRs |
|
48 | + public $goto = null; // GO TO url after processing |
|
49 | + public $err = null; // default ERRor image filename |
|
50 | + public $xto = null; // extract eXif Thumbnail Only |
|
51 | + public $ra = null; // Rotate by Angle |
|
52 | + public $ar = null; // Auto Rotate |
|
53 | + public $aoe = null; // Allow Output Enlargement |
|
54 | + public $far = null; // Fixed Aspect Ratio |
|
55 | + public $iar = null; // Ignore Aspect Ratio |
|
56 | + public $maxb = null; // MAXimum Bytes |
|
57 | + public $down = null; // DOWNload thumbnail filename |
|
58 | + public $md5s = null; // MD5 hash of Source image |
|
59 | + public $sfn = 0; // Source Frame Number |
|
60 | + public $dpi = 150; // Dots Per Inch for vector source formats |
|
61 | + public $sia = null; // Save Image As filename |
|
62 | + |
|
63 | + public $file = null; // >>>deprecated, DO NOT USE, will be removed in future versions<<< |
|
64 | 64 | |
65 | 65 | public $phpThumbDebug = null; |
66 | 66 | // END PARAMETERS |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | public $config_cache_source_filemtime_ignore_remote = true; |
131 | 131 | public $config_cache_default_only_suffix = false; |
132 | 132 | public $config_cache_force_passthru = true; |
133 | - public $config_cache_prefix = ''; // default value set in the constructor below |
|
133 | + public $config_cache_prefix = ''; // default value set in the constructor below |
|
134 | 134 | |
135 | 135 | // * MySQL |
136 | 136 | public $config_mysql_extension = null; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | public $config_disable_debug = true; |
148 | 148 | public $config_allow_src_above_docroot = false; |
149 | 149 | public $config_allow_src_above_phpthumb = true; |
150 | - public $config_auto_allow_symlinks = true; // allow symlink target directories without explicitly whitelisting them |
|
150 | + public $config_auto_allow_symlinks = true; // allow symlink target directories without explicitly whitelisting them |
|
151 | 151 | public $config_additional_allowed_dirs = []; // additional directories to allow source images to be read from |
152 | 152 | |
153 | 153 | // * HTTP fopen |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | public function phpThumb() |
228 | 228 | { |
229 | 229 | $this->DebugTimingMessage('phpThumb() constructor', __FILE__, __LINE__); |
230 | - $this->DebugMessage('phpThumb() v' . $this->phpthumb_version, __FILE__, __LINE__); |
|
230 | + $this->DebugMessage('phpThumb() v'.$this->phpthumb_version, __FILE__, __LINE__); |
|
231 | 231 | |
232 | 232 | foreach ([ini_get('memory_limit'), get_cfg_var('memory_limit')] as $php_config_memory_limit) { |
233 | 233 | if (strlen($php_config_memory_limit)) { |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $this->iswindows = ('WIN' === strtoupper(substr(PHP_OS, 0, 3))); |
247 | 247 | $this->issafemode = (bool)preg_match('#(1|ON)#i', ini_get('safe_mode')); |
248 | 248 | $this->config_document_root = (!empty($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : $this->config_document_root); |
249 | - $this->config_cache_prefix = (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] . '_' : ''); |
|
249 | + $this->config_cache_prefix = (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'].'_' : ''); |
|
250 | 250 | |
251 | 251 | $this->purgeTempFiles(); // purge existing temp files if re-initializing object |
252 | 252 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | { |
276 | 276 | foreach ($this->tempFilesToDelete as $tempFileToDelete) { |
277 | 277 | if (file_exists($tempFileToDelete)) { |
278 | - $this->DebugMessage('Deleting temp file "' . $tempFileToDelete . '"', __FILE__, __LINE__); |
|
278 | + $this->DebugMessage('Deleting temp file "'.$tempFileToDelete.'"', __FILE__, __LINE__); |
|
279 | 279 | @unlink($tempFileToDelete); |
280 | 280 | } |
281 | 281 | } |
@@ -300,12 +300,12 @@ discard block |
||
300 | 300 | $sourceFileExtension = strtolower(substr(strrchr($sourceFilename, '.'), 1)); |
301 | 301 | if (preg_match('#^[a-z]{3,4}$#', $sourceFileExtension)) { |
302 | 302 | $this->config_output_format = $sourceFileExtension; |
303 | - $this->DebugMessage('setSourceFilename(' . $sourceFilename . ') set $this->config_output_format to "' . $sourceFileExtension . '"', __FILE__, __LINE__); |
|
303 | + $this->DebugMessage('setSourceFilename('.$sourceFilename.') set $this->config_output_format to "'.$sourceFileExtension.'"', __FILE__, __LINE__); |
|
304 | 304 | } else { |
305 | - $this->DebugMessage('setSourceFilename(' . $sourceFilename . ') did NOT set $this->config_output_format to "' . $sourceFileExtension . '" because it did not seem like an appropriate image format', __FILE__, __LINE__); |
|
305 | + $this->DebugMessage('setSourceFilename('.$sourceFilename.') did NOT set $this->config_output_format to "'.$sourceFileExtension.'" because it did not seem like an appropriate image format', __FILE__, __LINE__); |
|
306 | 306 | } |
307 | 307 | } |
308 | - $this->DebugMessage('setSourceFilename(' . $sourceFilename . ') set $this->sourceFilename to "' . $this->sourceFilename . '"', __FILE__, __LINE__); |
|
308 | + $this->DebugMessage('setSourceFilename('.$sourceFilename.') set $this->sourceFilename to "'.$this->sourceFilename.'"', __FILE__, __LINE__); |
|
309 | 309 | |
310 | 310 | return true; |
311 | 311 | } |
@@ -322,20 +322,20 @@ discard block |
||
322 | 322 | //$this->resetObject(); |
323 | 323 | //$this->sourceFilename = null; |
324 | 324 | $this->rawImageData = $rawImageData; |
325 | - $this->DebugMessage('setSourceData() setting $this->rawImageData (' . strlen($this->rawImageData) . ' bytes; magic="' . substr($this->rawImageData, 0, 4) . '" (' . phpthumb_functions::HexCharDisplay(substr($this->rawImageData, 0, 4)) . '))', __FILE__, __LINE__); |
|
325 | + $this->DebugMessage('setSourceData() setting $this->rawImageData ('.strlen($this->rawImageData).' bytes; magic="'.substr($this->rawImageData, 0, 4).'" ('.phpthumb_functions::HexCharDisplay(substr($this->rawImageData, 0, 4)).'))', __FILE__, __LINE__); |
|
326 | 326 | if ($this->config_cache_source_enabled) { |
327 | 327 | $sourceFilename = ($sourceFilename ?: md5($rawImageData)); |
328 | 328 | if (!is_dir($this->config_cache_source_directory)) { |
329 | - $this->ErrorImage('$this->config_cache_source_directory (' . $this->config_cache_source_directory . ') is not a directory'); |
|
329 | + $this->ErrorImage('$this->config_cache_source_directory ('.$this->config_cache_source_directory.') is not a directory'); |
|
330 | 330 | } elseif (!@is_writable($this->config_cache_source_directory)) { |
331 | - $this->ErrorImage('$this->config_cache_source_directory (' . $this->config_cache_source_directory . ') is not writable'); |
|
331 | + $this->ErrorImage('$this->config_cache_source_directory ('.$this->config_cache_source_directory.') is not writable'); |
|
332 | 332 | } |
333 | - $this->DebugMessage('setSourceData() attempting to save source image to "' . $this->config_cache_source_directory . DIRECTORY_SEPARATOR . urlencode($sourceFilename) . '"', __FILE__, __LINE__); |
|
334 | - if ($fp = @fopen($this->config_cache_source_directory . DIRECTORY_SEPARATOR . urlencode($sourceFilename), 'wb')) { |
|
333 | + $this->DebugMessage('setSourceData() attempting to save source image to "'.$this->config_cache_source_directory.DIRECTORY_SEPARATOR.urlencode($sourceFilename).'"', __FILE__, __LINE__); |
|
334 | + if ($fp = @fopen($this->config_cache_source_directory.DIRECTORY_SEPARATOR.urlencode($sourceFilename), 'wb')) { |
|
335 | 335 | fwrite($fp, $rawImageData); |
336 | 336 | fclose($fp); |
337 | 337 | } elseif (!$this->phpThumbDebug) { |
338 | - $this->ErrorImage('setSourceData() failed to write to source cache (' . $this->config_cache_source_directory . DIRECTORY_SEPARATOR . urlencode($sourceFilename) . ')'); |
|
338 | + $this->ErrorImage('setSourceData() failed to write to source cache ('.$this->config_cache_source_directory.DIRECTORY_SEPARATOR.urlencode($sourceFilename).')'); |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | |
@@ -461,9 +461,9 @@ discard block |
||
461 | 461 | // } |
462 | 462 | $this->ImageResizeFunction($this->gdimg_output, $this->gdimg_source, $destination_offset_x, $destination_offset_y, $this->thumbnailCropX, $this->thumbnailCropY, $this->thumbnail_image_width, $this->thumbnail_image_height, $this->thumbnailCropW, $this->thumbnailCropH); |
463 | 463 | |
464 | - $this->DebugMessage('memory_get_usage() after copy-resize = ' . (function_exists('memory_get_usage') ? @memory_get_usage() : 'n/a'), __FILE__, __LINE__); |
|
464 | + $this->DebugMessage('memory_get_usage() after copy-resize = '.(function_exists('memory_get_usage') ? @memory_get_usage() : 'n/a'), __FILE__, __LINE__); |
|
465 | 465 | imagedestroy($this->gdimg_source); |
466 | - $this->DebugMessage('memory_get_usage() after imagedestroy = ' . (function_exists('memory_get_usage') ? @memory_get_usage() : 'n/a'), __FILE__, __LINE__); |
|
466 | + $this->DebugMessage('memory_get_usage() after imagedestroy = '.(function_exists('memory_get_usage') ? @memory_get_usage() : 'n/a'), __FILE__, __LINE__); |
|
467 | 467 | |
468 | 468 | $this->phpThumbDebug('8i'); |
469 | 469 | $this->AntiOffsiteLinking(); |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | return false; |
499 | 499 | } |
500 | 500 | if ($this->useRawIMoutput) { |
501 | - $this->DebugMessage('RenderOutput copying $this->IMresizedData (' . strlen($this->IMresizedData) . ' bytes) to $this->outputImage', __FILE__, __LINE__); |
|
501 | + $this->DebugMessage('RenderOutput copying $this->IMresizedData ('.strlen($this->IMresizedData).' bytes) to $this->outputImage', __FILE__, __LINE__); |
|
502 | 502 | $this->outputImageData = $this->IMresizedData; |
503 | 503 | |
504 | 504 | return true; |
@@ -513,10 +513,10 @@ discard block |
||
513 | 513 | $builtin_formats['png'] = (bool)($imagetypes & IMG_PNG); |
514 | 514 | } |
515 | 515 | |
516 | - $this->DebugMessage('imageinterlace($this->gdimg_output, ' . (int)$this->config_output_interlace . ')', __FILE__, __LINE__); |
|
516 | + $this->DebugMessage('imageinterlace($this->gdimg_output, '.(int)$this->config_output_interlace.')', __FILE__, __LINE__); |
|
517 | 517 | imageinterlace($this->gdimg_output, (int)$this->config_output_interlace); |
518 | 518 | |
519 | - $this->DebugMessage('RenderOutput() attempting image' . strtolower(@$this->thumbnailFormat) . '($this->gdimg_output)', __FILE__, __LINE__); |
|
519 | + $this->DebugMessage('RenderOutput() attempting image'.strtolower(@$this->thumbnailFormat).'($this->gdimg_output)', __FILE__, __LINE__); |
|
520 | 520 | ob_start(); |
521 | 521 | switch ($this->thumbnailFormat) { |
522 | 522 | case 'wbmp': |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | if (($this->thumbnailQuality >= -1) && ($this->thumbnailQuality <= 9)) { |
564 | 564 | $PNGquality = $this->thumbnailQuality; |
565 | 565 | } else { |
566 | - $this->DebugMessage('Specified thumbnailQuality "' . $this->thumbnailQuality . '" is outside the accepted range (0-9, or -1). Using 6 as default value.', __FILE__, __LINE__); |
|
566 | + $this->DebugMessage('Specified thumbnailQuality "'.$this->thumbnailQuality.'" is outside the accepted range (0-9, or -1). Using 6 as default value.', __FILE__, __LINE__); |
|
567 | 567 | $PNGquality = 6; |
568 | 568 | } |
569 | 569 | imagepng($this->gdimg_output, null, $PNGquality); |
@@ -585,8 +585,8 @@ discard block |
||
585 | 585 | break; |
586 | 586 | |
587 | 587 | case 'bmp': |
588 | - if (!@require_once __DIR__ . '/phpthumb.bmp.php') { |
|
589 | - $this->DebugMessage('Error including "' . __DIR__ . '/phpthumb.bmp.php" which is required for BMP format output', __FILE__, __LINE__); |
|
588 | + if (!@require_once __DIR__.'/phpthumb.bmp.php') { |
|
589 | + $this->DebugMessage('Error including "'.__DIR__.'/phpthumb.bmp.php" which is required for BMP format output', __FILE__, __LINE__); |
|
590 | 590 | ob_end_clean(); |
591 | 591 | |
592 | 592 | return false; |
@@ -597,8 +597,8 @@ discard block |
||
597 | 597 | break; |
598 | 598 | |
599 | 599 | case 'ico': |
600 | - if (!@require_once __DIR__ . '/phpthumb.ico.php') { |
|
601 | - $this->DebugMessage('Error including "' . __DIR__ . '/phpthumb.ico.php" which is required for ICO format output', __FILE__, __LINE__); |
|
600 | + if (!@require_once __DIR__.'/phpthumb.ico.php') { |
|
601 | + $this->DebugMessage('Error including "'.__DIR__.'/phpthumb.ico.php" which is required for ICO format output', __FILE__, __LINE__); |
|
602 | 602 | ob_end_clean(); |
603 | 603 | |
604 | 604 | return false; |
@@ -610,19 +610,19 @@ discard block |
||
610 | 610 | break; |
611 | 611 | |
612 | 612 | default: |
613 | - $this->DebugMessage('RenderOutput failed because $this->thumbnailFormat "' . $this->thumbnailFormat . '" is not valid', __FILE__, __LINE__); |
|
613 | + $this->DebugMessage('RenderOutput failed because $this->thumbnailFormat "'.$this->thumbnailFormat.'" is not valid', __FILE__, __LINE__); |
|
614 | 614 | ob_end_clean(); |
615 | 615 | |
616 | 616 | return false; |
617 | 617 | } |
618 | 618 | ob_end_clean(); |
619 | 619 | if (!$this->outputImageData) { |
620 | - $this->DebugMessage('RenderOutput() for "' . $this->thumbnailFormat . '" failed', __FILE__, __LINE__); |
|
620 | + $this->DebugMessage('RenderOutput() for "'.$this->thumbnailFormat.'" failed', __FILE__, __LINE__); |
|
621 | 621 | ob_end_clean(); |
622 | 622 | |
623 | 623 | return false; |
624 | 624 | } |
625 | - $this->DebugMessage('RenderOutput() completing with $this->outputImageData = ' . strlen($this->outputImageData) . ' bytes', __FILE__, __LINE__); |
|
625 | + $this->DebugMessage('RenderOutput() completing with $this->outputImageData = '.strlen($this->outputImageData).' bytes', __FILE__, __LINE__); |
|
626 | 626 | |
627 | 627 | return true; |
628 | 628 | } |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | public function RenderToFile($filename) |
637 | 637 | { |
638 | 638 | if (preg_match('#^[a-z0-9]+://#i', $filename)) { |
639 | - $this->DebugMessage('RenderToFile() failed because $filename (' . $filename . ') is a URL', __FILE__, __LINE__); |
|
639 | + $this->DebugMessage('RenderToFile() failed because $filename ('.$filename.') is a URL', __FILE__, __LINE__); |
|
640 | 640 | |
641 | 641 | return false; |
642 | 642 | } |
@@ -647,27 +647,27 @@ discard block |
||
647 | 647 | $renderfilename = $this->ResolveFilenameToAbsolute($renderfilename); |
648 | 648 | } |
649 | 649 | if (!@is_writable(dirname($renderfilename))) { |
650 | - $this->DebugMessage('RenderToFile() failed because "' . dirname($renderfilename) . '/" is not writable', __FILE__, __LINE__); |
|
650 | + $this->DebugMessage('RenderToFile() failed because "'.dirname($renderfilename).'/" is not writable', __FILE__, __LINE__); |
|
651 | 651 | |
652 | 652 | return false; |
653 | 653 | } |
654 | 654 | if (@is_file($renderfilename) && !@is_writable($renderfilename)) { |
655 | - $this->DebugMessage('RenderToFile() failed because "' . $renderfilename . '" is not writable', __FILE__, __LINE__); |
|
655 | + $this->DebugMessage('RenderToFile() failed because "'.$renderfilename.'" is not writable', __FILE__, __LINE__); |
|
656 | 656 | |
657 | 657 | return false; |
658 | 658 | } |
659 | 659 | |
660 | 660 | if ($this->RenderOutput()) { |
661 | 661 | if (file_put_contents($renderfilename, $this->outputImageData)) { |
662 | - $this->DebugMessage('RenderToFile(' . $renderfilename . ') succeeded', __FILE__, __LINE__); |
|
662 | + $this->DebugMessage('RenderToFile('.$renderfilename.') succeeded', __FILE__, __LINE__); |
|
663 | 663 | |
664 | 664 | return true; |
665 | 665 | } |
666 | 666 | if (!@file_exists($renderfilename)) { |
667 | - $this->DebugMessage('RenderOutput [' . $this->thumbnailFormat . '(' . $renderfilename . ')] did not appear to fail, but the output image does not exist either...', __FILE__, __LINE__); |
|
667 | + $this->DebugMessage('RenderOutput ['.$this->thumbnailFormat.'('.$renderfilename.')] did not appear to fail, but the output image does not exist either...', __FILE__, __LINE__); |
|
668 | 668 | } |
669 | 669 | } else { |
670 | - $this->DebugMessage('RenderOutput [' . $this->thumbnailFormat . '(' . $renderfilename . ')] failed', __FILE__, __LINE__); |
|
670 | + $this->DebugMessage('RenderOutput ['.$this->thumbnailFormat.'('.$renderfilename.')] failed', __FILE__, __LINE__); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | return false; |
@@ -691,37 +691,37 @@ discard block |
||
691 | 691 | return $this->ErrorImage('OutputThumbnail() failed - headers already sent'); |
692 | 692 | } |
693 | 693 | |
694 | - $downloadfilename = phpthumb_functions::SanitizeFilename(is_string($this->sia) ? $this->sia : ($this->down ?: 'phpThumb_generated_thumbnail' . '.' . $this->thumbnailFormat)); |
|
695 | - $this->DebugMessage('Content-Disposition header filename set to "' . $downloadfilename . '"', __FILE__, __LINE__); |
|
694 | + $downloadfilename = phpthumb_functions::SanitizeFilename(is_string($this->sia) ? $this->sia : ($this->down ?: 'phpThumb_generated_thumbnail'.'.'.$this->thumbnailFormat)); |
|
695 | + $this->DebugMessage('Content-Disposition header filename set to "'.$downloadfilename.'"', __FILE__, __LINE__); |
|
696 | 696 | if ($downloadfilename) { |
697 | - header('Content-Disposition: ' . ($this->down ? 'attachment' : 'inline') . '; filename="' . $downloadfilename . '"'); |
|
697 | + header('Content-Disposition: '.($this->down ? 'attachment' : 'inline').'; filename="'.$downloadfilename.'"'); |
|
698 | 698 | } else { |
699 | 699 | $this->DebugMessage('failed to send Content-Disposition header because $downloadfilename is empty', __FILE__, __LINE__); |
700 | 700 | } |
701 | 701 | |
702 | 702 | if ($this->useRawIMoutput) { |
703 | - header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat)); |
|
703 | + header('Content-Type: '.phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat)); |
|
704 | 704 | echo $this->IMresizedData; |
705 | 705 | } else { |
706 | - $this->DebugMessage('imageinterlace($this->gdimg_output, ' . (int)$this->config_output_interlace . ')', __FILE__, __LINE__); |
|
706 | + $this->DebugMessage('imageinterlace($this->gdimg_output, '.(int)$this->config_output_interlace.')', __FILE__, __LINE__); |
|
707 | 707 | imageinterlace($this->gdimg_output, (int)$this->config_output_interlace); |
708 | 708 | switch ($this->thumbnailFormat) { |
709 | 709 | case 'jpeg': |
710 | - header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat)); |
|
711 | - $ImageOutFunction = 'image' . $this->thumbnailFormat; |
|
710 | + header('Content-Type: '.phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat)); |
|
711 | + $ImageOutFunction = 'image'.$this->thumbnailFormat; |
|
712 | 712 | @$ImageOutFunction($this->gdimg_output, null, $this->thumbnailQuality); |
713 | 713 | break; |
714 | 714 | |
715 | 715 | case 'png': |
716 | 716 | case 'gif': |
717 | - header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat)); |
|
718 | - $ImageOutFunction = 'image' . $this->thumbnailFormat; |
|
717 | + header('Content-Type: '.phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat)); |
|
718 | + $ImageOutFunction = 'image'.$this->thumbnailFormat; |
|
719 | 719 | @$ImageOutFunction($this->gdimg_output); |
720 | 720 | break; |
721 | 721 | |
722 | 722 | case 'bmp': |
723 | - if (!@require_once __DIR__ . '/phpthumb.bmp.php') { |
|
724 | - $this->DebugMessage('Error including "' . __DIR__ . '/phpthumb.bmp.php" which is required for BMP format output', __FILE__, __LINE__); |
|
723 | + if (!@require_once __DIR__.'/phpthumb.bmp.php') { |
|
724 | + $this->DebugMessage('Error including "'.__DIR__.'/phpthumb.bmp.php" which is required for BMP format output', __FILE__, __LINE__); |
|
725 | 725 | |
726 | 726 | return false; |
727 | 727 | } |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | |
735 | 735 | return false; |
736 | 736 | } |
737 | - header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat)); |
|
737 | + header('Content-Type: '.phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat)); |
|
738 | 738 | echo $bmp_data; |
739 | 739 | } else { |
740 | 740 | $this->DebugMessage('new phpthumb_bmp() failed', __FILE__, __LINE__); |
@@ -744,8 +744,8 @@ discard block |
||
744 | 744 | break; |
745 | 745 | |
746 | 746 | case 'ico': |
747 | - if (!@require_once __DIR__ . '/phpthumb.ico.php') { |
|
748 | - $this->DebugMessage('Error including "' . __DIR__ . '/phpthumb.ico.php" which is required for ICO format output', __FILE__, __LINE__); |
|
747 | + if (!@require_once __DIR__.'/phpthumb.ico.php') { |
|
748 | + $this->DebugMessage('Error including "'.__DIR__.'/phpthumb.ico.php" which is required for ICO format output', __FILE__, __LINE__); |
|
749 | 749 | |
750 | 750 | return false; |
751 | 751 | } |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | |
760 | 760 | return false; |
761 | 761 | } |
762 | - header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat)); |
|
762 | + header('Content-Type: '.phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat)); |
|
763 | 763 | echo $ico_data; |
764 | 764 | } else { |
765 | 765 | $this->DebugMessage('new phpthumb_ico() failed', __FILE__, __LINE__); |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | break; |
770 | 770 | |
771 | 771 | default: |
772 | - $this->DebugMessage('OutputThumbnail failed because $this->thumbnailFormat "' . $this->thumbnailFormat . '" is not valid', __FILE__, __LINE__); |
|
772 | + $this->DebugMessage('OutputThumbnail failed because $this->thumbnailFormat "'.$this->thumbnailFormat.'" is not valid', __FILE__, __LINE__); |
|
773 | 773 | |
774 | 774 | return false; |
775 | 775 | break; |
@@ -795,21 +795,21 @@ discard block |
||
795 | 795 | . ' files)', __FILE__, __LINE__); |
796 | 796 | |
797 | 797 | if (!is_writable($this->config_cache_directory)) { |
798 | - $this->DebugMessage('CleanUpCacheDirectory() skipped because "' . $this->config_cache_directory . '" is not writable', __FILE__, __LINE__); |
|
798 | + $this->DebugMessage('CleanUpCacheDirectory() skipped because "'.$this->config_cache_directory.'" is not writable', __FILE__, __LINE__); |
|
799 | 799 | |
800 | 800 | return true; |
801 | 801 | } |
802 | 802 | |
803 | 803 | // cache status of cache directory for 1 hour to avoid hammering the filesystem functions |
804 | - $phpThumbCacheStats_filename = $this->config_cache_directory . DIRECTORY_SEPARATOR . 'phpThumbCacheStats.txt'; |
|
804 | + $phpThumbCacheStats_filename = $this->config_cache_directory.DIRECTORY_SEPARATOR.'phpThumbCacheStats.txt'; |
|
805 | 805 | if (file_exists($phpThumbCacheStats_filename) && is_readable($phpThumbCacheStats_filename) |
806 | 806 | && (filemtime($phpThumbCacheStats_filename) >= (time() - 3600))) { |
807 | - $this->DebugMessage('CleanUpCacheDirectory() skipped because "' . $phpThumbCacheStats_filename . '" is recently modified', __FILE__, __LINE__); |
|
807 | + $this->DebugMessage('CleanUpCacheDirectory() skipped because "'.$phpThumbCacheStats_filename.'" is recently modified', __FILE__, __LINE__); |
|
808 | 808 | |
809 | 809 | return true; |
810 | 810 | } |
811 | 811 | if (!@touch($phpThumbCacheStats_filename)) { |
812 | - $this->DebugMessage('touch(' . $phpThumbCacheStats_filename . ') failed', __FILE__, __LINE__); |
|
812 | + $this->DebugMessage('touch('.$phpThumbCacheStats_filename.') failed', __FILE__, __LINE__); |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | $DeletedKeys = []; |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | $CacheDirOldFilesSize = []; |
821 | 821 | $AllFilesInCacheDirectory = phpthumb_functions::GetAllFilesInSubfolders($this->config_cache_directory); |
822 | 822 | foreach ($AllFilesInCacheDirectory as $fullfilename) { |
823 | - if (preg_match('#' . preg_quote($this->config_cache_prefix) . '#i', $fullfilename) |
|
823 | + if (preg_match('#'.preg_quote($this->config_cache_prefix).'#i', $fullfilename) |
|
824 | 824 | && file_exists($fullfilename)) { |
825 | 825 | $CacheDirOldFilesAge[$fullfilename] = @fileatime($fullfilename); |
826 | 826 | if (0 == $CacheDirOldFilesAge[$fullfilename]) { |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | } |
831 | 831 | } |
832 | 832 | if (empty($CacheDirOldFilesSize)) { |
833 | - $this->DebugMessage('CleanUpCacheDirectory() skipped because $CacheDirOldFilesSize is empty (phpthumb_functions::GetAllFilesInSubfolders(' . $this->config_cache_directory . ') found no files)', __FILE__, __LINE__); |
|
833 | + $this->DebugMessage('CleanUpCacheDirectory() skipped because $CacheDirOldFilesSize is empty (phpthumb_functions::GetAllFilesInSubfolders('.$this->config_cache_directory.') found no files)', __FILE__, __LINE__); |
|
834 | 834 | |
835 | 835 | return true; |
836 | 836 | } |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | // purge all zero-size files more than an hour old (to prevent trying to delete just-created and/or in-use files) |
840 | 840 | $cutofftime = time() - 3600; |
841 | 841 | if ((0 == $filesize) && ($CacheDirOldFilesAge[$fullfilename] < $cutofftime)) { |
842 | - $this->DebugMessage('deleting "' . $fullfilename . '"', __FILE__, __LINE__); |
|
842 | + $this->DebugMessage('deleting "'.$fullfilename.'"', __FILE__, __LINE__); |
|
843 | 843 | if (@unlink($fullfilename)) { |
844 | 844 | $DeletedKeys['zerobyte'][] = $fullfilename; |
845 | 845 | unset($CacheDirOldFilesSize[$fullfilename]); |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | } |
848 | 848 | } |
849 | 849 | } |
850 | - $this->DebugMessage('CleanUpCacheDirectory() purged ' . count($DeletedKeys['zerobyte']) . ' zero-byte files', __FILE__, __LINE__); |
|
850 | + $this->DebugMessage('CleanUpCacheDirectory() purged '.count($DeletedKeys['zerobyte']).' zero-byte files', __FILE__, __LINE__); |
|
851 | 851 | asort($CacheDirOldFilesAge); |
852 | 852 | |
853 | 853 | if ($this->config_cache_maxfiles > 0) { |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | $DeletedKeys['maxfiles'] = []; |
856 | 856 | foreach ($CacheDirOldFilesAge as $fullfilename => $filedate) { |
857 | 857 | if ($TotalCachedFiles > $this->config_cache_maxfiles) { |
858 | - $this->DebugMessage('deleting "' . $fullfilename . '"', __FILE__, __LINE__); |
|
858 | + $this->DebugMessage('deleting "'.$fullfilename.'"', __FILE__, __LINE__); |
|
859 | 859 | if (@unlink($fullfilename)) { |
860 | 860 | $TotalCachedFiles--; |
861 | 861 | $DeletedKeys['maxfiles'][] = $fullfilename; |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | break; |
866 | 866 | } |
867 | 867 | } |
868 | - $this->DebugMessage('CleanUpCacheDirectory() purged ' . count($DeletedKeys['maxfiles']) . ' files based on (config_cache_maxfiles=' . $this->config_cache_maxfiles . ')', __FILE__, __LINE__); |
|
868 | + $this->DebugMessage('CleanUpCacheDirectory() purged '.count($DeletedKeys['maxfiles']).' files based on (config_cache_maxfiles='.$this->config_cache_maxfiles.')', __FILE__, __LINE__); |
|
869 | 869 | foreach ($DeletedKeys['maxfiles'] as $fullfilename) { |
870 | 870 | unset($CacheDirOldFilesAge[$fullfilename]); |
871 | 871 | unset($CacheDirOldFilesSize[$fullfilename]); |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | foreach ($CacheDirOldFilesAge as $fullfilename => $filedate) { |
879 | 879 | if ($filedate > 0) { |
880 | 880 | if ($filedate < $mindate) { |
881 | - $this->DebugMessage('deleting "' . $fullfilename . '"', __FILE__, __LINE__); |
|
881 | + $this->DebugMessage('deleting "'.$fullfilename.'"', __FILE__, __LINE__); |
|
882 | 882 | if (@unlink($fullfilename)) { |
883 | 883 | $DeletedKeys['maxage'][] = $fullfilename; |
884 | 884 | } |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | } |
889 | 889 | } |
890 | 890 | } |
891 | - $this->DebugMessage('CleanUpCacheDirectory() purged ' . count($DeletedKeys['maxage']) . ' files based on (config_cache_maxage=' . $this->config_cache_maxage . ')', __FILE__, __LINE__); |
|
891 | + $this->DebugMessage('CleanUpCacheDirectory() purged '.count($DeletedKeys['maxage']).' files based on (config_cache_maxage='.$this->config_cache_maxage.')', __FILE__, __LINE__); |
|
892 | 892 | foreach ($DeletedKeys['maxage'] as $fullfilename) { |
893 | 893 | unset($CacheDirOldFilesAge[$fullfilename]); |
894 | 894 | unset($CacheDirOldFilesSize[$fullfilename]); |
@@ -900,9 +900,9 @@ discard block |
||
900 | 900 | $DeletedKeys['maxsize'] = []; |
901 | 901 | foreach ($CacheDirOldFilesAge as $fullfilename => $filedate) { |
902 | 902 | if ($TotalCachedFileSize > $this->config_cache_maxsize) { |
903 | - $this->DebugMessage('deleting "' . $fullfilename . '"', __FILE__, __LINE__); |
|
903 | + $this->DebugMessage('deleting "'.$fullfilename.'"', __FILE__, __LINE__); |
|
904 | 904 | if (@unlink($fullfilename)) { |
905 | - $TotalCachedFileSize -= $CacheDirOldFilesSize[$fullfilename]; |
|
905 | + $TotalCachedFileSize -= $CacheDirOldFilesSize[$fullfilename]; |
|
906 | 906 | $DeletedKeys['maxsize'][] = $fullfilename; |
907 | 907 | } |
908 | 908 | } else { |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | break; |
911 | 911 | } |
912 | 912 | } |
913 | - $this->DebugMessage('CleanUpCacheDirectory() purged ' . count($DeletedKeys['maxsize']) . ' files based on (config_cache_maxsize=' . $this->config_cache_maxsize . ')', __FILE__, __LINE__); |
|
913 | + $this->DebugMessage('CleanUpCacheDirectory() purged '.count($DeletedKeys['maxsize']).' files based on (config_cache_maxsize='.$this->config_cache_maxsize.')', __FILE__, __LINE__); |
|
914 | 914 | foreach ($DeletedKeys['maxsize'] as $fullfilename) { |
915 | 915 | unset($CacheDirOldFilesAge[$fullfilename]); |
916 | 916 | unset($CacheDirOldFilesSize[$fullfilename]); |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | foreach ($DeletedKeys as $key => $value) { |
924 | 924 | $totalpurged += count($value); |
925 | 925 | } |
926 | - $this->DebugMessage('CleanUpCacheDirectory() purged ' . $totalpurged . ' files (from ' . count($AllFilesInCacheDirectory) . ') based on config settings', __FILE__, __LINE__); |
|
926 | + $this->DebugMessage('CleanUpCacheDirectory() purged '.$totalpurged.' files (from '.count($AllFilesInCacheDirectory).') based on config settings', __FILE__, __LINE__); |
|
927 | 927 | if ($totalpurged > 0) { |
928 | 928 | $empty_dirs = []; |
929 | 929 | foreach ($AllFilesInCacheDirectory as $fullfilename) { |
@@ -942,10 +942,10 @@ discard block |
||
942 | 942 | } elseif (@rmdir($empty_dir)) { |
943 | 943 | $totalpurgeddirs++; |
944 | 944 | } else { |
945 | - $this->DebugMessage('failed to rmdir(' . $empty_dir . ')', __FILE__, __LINE__); |
|
945 | + $this->DebugMessage('failed to rmdir('.$empty_dir.')', __FILE__, __LINE__); |
|
946 | 946 | } |
947 | 947 | } |
948 | - $this->DebugMessage('purged ' . $totalpurgeddirs . ' empty directories', __FILE__, __LINE__); |
|
948 | + $this->DebugMessage('purged '.$totalpurgeddirs.' empty directories', __FILE__, __LINE__); |
|
949 | 949 | } |
950 | 950 | |
951 | 951 | return true; |
@@ -985,16 +985,16 @@ discard block |
||
985 | 985 | } |
986 | 986 | if ($this->rawImageData) { |
987 | 987 | $this->sourceFilename = null; |
988 | - $this->DebugMessage('ResolveSource() exiting because $this->rawImageData is set (' . number_format(strlen($this->rawImageData)) . ' bytes)', __FILE__, __LINE__); |
|
988 | + $this->DebugMessage('ResolveSource() exiting because $this->rawImageData is set ('.number_format(strlen($this->rawImageData)).' bytes)', __FILE__, __LINE__); |
|
989 | 989 | |
990 | 990 | return true; |
991 | 991 | } |
992 | 992 | if ($this->sourceFilename) { |
993 | 993 | $this->sourceFilename = $this->ResolveFilenameToAbsolute($this->sourceFilename); |
994 | - $this->DebugMessage('$this->sourceFilename set to "' . $this->sourceFilename . '"', __FILE__, __LINE__); |
|
994 | + $this->DebugMessage('$this->sourceFilename set to "'.$this->sourceFilename.'"', __FILE__, __LINE__); |
|
995 | 995 | } elseif ($this->src) { |
996 | 996 | $this->sourceFilename = $this->ResolveFilenameToAbsolute($this->src); |
997 | - $this->DebugMessage('$this->sourceFilename set to "' . $this->sourceFilename . '" from $this->src (' . $this->src . ')', __FILE__, __LINE__); |
|
997 | + $this->DebugMessage('$this->sourceFilename set to "'.$this->sourceFilename.'" from $this->src ('.$this->src.')', __FILE__, __LINE__); |
|
998 | 998 | } else { |
999 | 999 | return $this->ErrorImage('$this->sourceFilename and $this->src are both empty'); |
1000 | 1000 | } |
@@ -1009,12 +1009,12 @@ discard block |
||
1009 | 1009 | ini_set('user_agent', $this->config_http_user_agent); |
1010 | 1010 | } |
1011 | 1011 | } else { |
1012 | - return $this->ErrorImage('only FTP and HTTP/HTTPS protocols are allowed, "' . $protocol_matches[1] . '" is not'); |
|
1012 | + return $this->ErrorImage('only FTP and HTTP/HTTPS protocols are allowed, "'.$protocol_matches[1].'" is not'); |
|
1013 | 1013 | } |
1014 | 1014 | } elseif (!@file_exists($this->sourceFilename)) { |
1015 | - return $this->ErrorImage('"' . $this->sourceFilename . '" does not exist'); |
|
1015 | + return $this->ErrorImage('"'.$this->sourceFilename.'" does not exist'); |
|
1016 | 1016 | } elseif (!@is_file($this->sourceFilename)) { |
1017 | - return $this->ErrorImage('"' . $this->sourceFilename . '" is not a file'); |
|
1017 | + return $this->ErrorImage('"'.$this->sourceFilename.'" is not a file'); |
|
1018 | 1018 | } |
1019 | 1019 | |
1020 | 1020 | return true; |
@@ -1033,10 +1033,10 @@ discard block |
||
1033 | 1033 | |
1034 | 1034 | $AvailableImageOutputFormats = []; |
1035 | 1035 | $AvailableImageOutputFormats[] = 'text'; |
1036 | - if (@is_readable(__DIR__ . '/phpthumb.ico.php')) { |
|
1036 | + if (@is_readable(__DIR__.'/phpthumb.ico.php')) { |
|
1037 | 1037 | $AvailableImageOutputFormats[] = 'ico'; |
1038 | 1038 | } |
1039 | - if (@is_readable(__DIR__ . '/phpthumb.bmp.php')) { |
|
1039 | + if (@is_readable(__DIR__.'/phpthumb.bmp.php')) { |
|
1040 | 1040 | $AvailableImageOutputFormats[] = 'bmp'; |
1041 | 1041 | } |
1042 | 1042 | |
@@ -1066,13 +1066,13 @@ discard block |
||
1066 | 1066 | } |
1067 | 1067 | if ($this->ImageMagickVersion()) { |
1068 | 1068 | $IMformats = ['jpeg', 'png', 'gif', 'bmp', 'ico', 'wbmp']; |
1069 | - $this->DebugMessage('Addding ImageMagick formats to $AvailableImageOutputFormats (' . implode(';', $AvailableImageOutputFormats) . ')', __FILE__, __LINE__); |
|
1069 | + $this->DebugMessage('Addding ImageMagick formats to $AvailableImageOutputFormats ('.implode(';', $AvailableImageOutputFormats).')', __FILE__, __LINE__); |
|
1070 | 1070 | foreach ($IMformats as $key => $format) { |
1071 | 1071 | $AvailableImageOutputFormats[] = $format; |
1072 | 1072 | } |
1073 | 1073 | } |
1074 | 1074 | $AvailableImageOutputFormats = array_unique($AvailableImageOutputFormats); |
1075 | - $this->DebugMessage('$AvailableImageOutputFormats = array(' . implode(';', $AvailableImageOutputFormats) . ')', __FILE__, __LINE__); |
|
1075 | + $this->DebugMessage('$AvailableImageOutputFormats = array('.implode(';', $AvailableImageOutputFormats).')', __FILE__, __LINE__); |
|
1076 | 1076 | |
1077 | 1077 | $this->f = preg_replace('#[^a-z]#', '', strtolower($this->f)); |
1078 | 1078 | if ('jpg' === strtolower($this->config_output_format)) { |
@@ -1083,24 +1083,24 @@ discard block |
||
1083 | 1083 | } |
1084 | 1084 | if (phpthumb_functions::CaseInsensitiveInArray($this->config_output_format, $AvailableImageOutputFormats)) { |
1085 | 1085 | // set output format to config default if that format is available |
1086 | - $this->DebugMessage('$this->thumbnailFormat set to $this->config_output_format "' . strtolower($this->config_output_format) . '"', __FILE__, __LINE__); |
|
1086 | + $this->DebugMessage('$this->thumbnailFormat set to $this->config_output_format "'.strtolower($this->config_output_format).'"', __FILE__, __LINE__); |
|
1087 | 1087 | $this->thumbnailFormat = strtolower($this->config_output_format); |
1088 | 1088 | } elseif ($this->config_output_format) { |
1089 | - $this->DebugMessage('$this->thumbnailFormat staying as "' . $this->thumbnailFormat . '" because $this->config_output_format (' . strtolower($this->config_output_format) . ') is not in $AvailableImageOutputFormats', __FILE__, __LINE__); |
|
1089 | + $this->DebugMessage('$this->thumbnailFormat staying as "'.$this->thumbnailFormat.'" because $this->config_output_format ('.strtolower($this->config_output_format).') is not in $AvailableImageOutputFormats', __FILE__, __LINE__); |
|
1090 | 1090 | } |
1091 | 1091 | if ($this->f && phpthumb_functions::CaseInsensitiveInArray($this->f, $AvailableImageOutputFormats)) { |
1092 | 1092 | // override output format if $this->f is set and that format is available |
1093 | - $this->DebugMessage('$this->thumbnailFormat set to $this->f "' . strtolower($this->f) . '"', __FILE__, __LINE__); |
|
1093 | + $this->DebugMessage('$this->thumbnailFormat set to $this->f "'.strtolower($this->f).'"', __FILE__, __LINE__); |
|
1094 | 1094 | $this->thumbnailFormat = strtolower($this->f); |
1095 | 1095 | } elseif ($this->f) { |
1096 | - $this->DebugMessage('$this->thumbnailFormat staying as "' . $this->thumbnailFormat . '" because $this->f (' . strtolower($this->f) . ') is not in $AvailableImageOutputFormats', __FILE__, __LINE__); |
|
1096 | + $this->DebugMessage('$this->thumbnailFormat staying as "'.$this->thumbnailFormat.'" because $this->f ('.strtolower($this->f).') is not in $AvailableImageOutputFormats', __FILE__, __LINE__); |
|
1097 | 1097 | } |
1098 | 1098 | |
1099 | 1099 | // for JPEG images, quality 1 (worst) to 99 (best) |
1100 | 1100 | // quality < 25 is nasty, with not much size savings - not recommended |
1101 | 1101 | // problems with 100 - invalid JPEG? |
1102 | 1102 | $this->thumbnailQuality = max(1, min(99, ($this->q ? (int)$this->q : 75))); |
1103 | - $this->DebugMessage('$this->thumbnailQuality set to "' . $this->thumbnailQuality . '"', __FILE__, __LINE__); |
|
1103 | + $this->DebugMessage('$this->thumbnailQuality set to "'.$this->thumbnailQuality.'"', __FILE__, __LINE__); |
|
1104 | 1104 | |
1105 | 1105 | return true; |
1106 | 1106 | } |
@@ -1111,15 +1111,15 @@ discard block |
||
1111 | 1111 | public function setCacheDirectory() |
1112 | 1112 | { |
1113 | 1113 | // resolve cache directory to absolute pathname |
1114 | - $this->DebugMessage('setCacheDirectory() starting with config_cache_directory = "' . $this->config_cache_directory . '"', __FILE__, __LINE__); |
|
1114 | + $this->DebugMessage('setCacheDirectory() starting with config_cache_directory = "'.$this->config_cache_directory.'"', __FILE__, __LINE__); |
|
1115 | 1115 | if ('.' === substr($this->config_cache_directory, 0, 1)) { |
1116 | 1116 | if (preg_match('#^(f|ht)tps?\://#i', $this->src)) { |
1117 | 1117 | if (!$this->config_cache_disable_warning) { |
1118 | - $this->ErrorImage('$this->config_cache_directory (' . $this->config_cache_directory . ') cannot be used for remote images. Adjust "cache_directory" or "cache_disable_warning" in phpThumb.config.php'); |
|
1118 | + $this->ErrorImage('$this->config_cache_directory ('.$this->config_cache_directory.') cannot be used for remote images. Adjust "cache_directory" or "cache_disable_warning" in phpThumb.config.php'); |
|
1119 | 1119 | } |
1120 | 1120 | } elseif ($this->src) { |
1121 | 1121 | // resolve relative cache directory to source image |
1122 | - $this->config_cache_directory = dirname($this->ResolveFilenameToAbsolute($this->src)) . DIRECTORY_SEPARATOR . $this->config_cache_directory; |
|
1122 | + $this->config_cache_directory = dirname($this->ResolveFilenameToAbsolute($this->src)).DIRECTORY_SEPARATOR.$this->config_cache_directory; |
|
1123 | 1123 | } else { |
1124 | 1124 | // $this->new is probably set |
1125 | 1125 | } |
@@ -1133,31 +1133,31 @@ discard block |
||
1133 | 1133 | if ($this->config_cache_directory) { |
1134 | 1134 | $real_cache_path = $this->realPathSafe($this->config_cache_directory); |
1135 | 1135 | if (!$real_cache_path) { |
1136 | - $this->DebugMessage('$this->realPathSafe($this->config_cache_directory) failed for "' . $this->config_cache_directory . '"', __FILE__, __LINE__); |
|
1136 | + $this->DebugMessage('$this->realPathSafe($this->config_cache_directory) failed for "'.$this->config_cache_directory.'"', __FILE__, __LINE__); |
|
1137 | 1137 | if (!is_dir($this->config_cache_directory)) { |
1138 | - $this->DebugMessage('!is_dir(' . $this->config_cache_directory . ')', __FILE__, __LINE__); |
|
1138 | + $this->DebugMessage('!is_dir('.$this->config_cache_directory.')', __FILE__, __LINE__); |
|
1139 | 1139 | } |
1140 | 1140 | } |
1141 | 1141 | if ($real_cache_path) { |
1142 | - $this->DebugMessage('setting config_cache_directory to $this->realPathSafe(' . $this->config_cache_directory . ') = "' . $real_cache_path . '"', __FILE__, __LINE__); |
|
1142 | + $this->DebugMessage('setting config_cache_directory to $this->realPathSafe('.$this->config_cache_directory.') = "'.$real_cache_path.'"', __FILE__, __LINE__); |
|
1143 | 1143 | $this->config_cache_directory = $real_cache_path; |
1144 | 1144 | } |
1145 | 1145 | } |
1146 | 1146 | if (!is_dir($this->config_cache_directory)) { |
1147 | 1147 | if (!$this->config_cache_disable_warning) { |
1148 | - $this->ErrorImage('$this->config_cache_directory (' . $this->config_cache_directory . ') does not exist. Adjust "cache_directory" or "cache_disable_warning" in phpThumb.config.php'); |
|
1148 | + $this->ErrorImage('$this->config_cache_directory ('.$this->config_cache_directory.') does not exist. Adjust "cache_directory" or "cache_disable_warning" in phpThumb.config.php'); |
|
1149 | 1149 | } |
1150 | - $this->DebugMessage('$this->config_cache_directory (' . $this->config_cache_directory . ') is not a directory', __FILE__, __LINE__); |
|
1150 | + $this->DebugMessage('$this->config_cache_directory ('.$this->config_cache_directory.') is not a directory', __FILE__, __LINE__); |
|
1151 | 1151 | $this->config_cache_directory = null; |
1152 | 1152 | } elseif (!@is_writable($this->config_cache_directory)) { |
1153 | - $this->DebugMessage('$this->config_cache_directory is not writable (' . $this->config_cache_directory . ')', __FILE__, __LINE__); |
|
1153 | + $this->DebugMessage('$this->config_cache_directory is not writable ('.$this->config_cache_directory.')', __FILE__, __LINE__); |
|
1154 | 1154 | } |
1155 | 1155 | |
1156 | 1156 | $this->InitializeTempDirSetting(); |
1157 | 1157 | if (!@is_dir($this->config_temp_directory) && !@is_writable($this->config_temp_directory) |
1158 | 1158 | && @is_dir($this->config_cache_directory) |
1159 | 1159 | && @is_writable($this->config_cache_directory)) { |
1160 | - $this->DebugMessage('setting $this->config_temp_directory = $this->config_cache_directory (' . $this->config_cache_directory . ')', __FILE__, __LINE__); |
|
1160 | + $this->DebugMessage('setting $this->config_temp_directory = $this->config_cache_directory ('.$this->config_cache_directory.')', __FILE__, __LINE__); |
|
1161 | 1161 | $this->config_temp_directory = $this->config_cache_directory; |
1162 | 1162 | } |
1163 | 1163 | |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | { |
1239 | 1239 | if (!empty($allowed_dirs)) { |
1240 | 1240 | foreach ($allowed_dirs as $one_dir) { |
1241 | - if (preg_match('#^' . preg_quote(str_replace(DIRECTORY_SEPARATOR, '/', $this->realPathSafe($one_dir))) . '#', $path)) { |
|
1241 | + if (preg_match('#^'.preg_quote(str_replace(DIRECTORY_SEPARATOR, '/', $this->realPathSafe($one_dir))).'#', $path)) { |
|
1242 | 1242 | return true; |
1243 | 1243 | } |
1244 | 1244 | } |
@@ -1258,7 +1258,7 @@ discard block |
||
1258 | 1258 | static $open_basedirs = null; |
1259 | 1259 | if (null === $open_basedirs) { |
1260 | 1260 | $ini_text = ini_get('open_basedir'); |
1261 | - $this->DebugMessage('open_basedir: "' . $ini_text . '"', __FILE__, __LINE__); |
|
1261 | + $this->DebugMessage('open_basedir: "'.$ini_text.'"', __FILE__, __LINE__); |
|
1262 | 1262 | $open_basedirs = []; |
1263 | 1263 | if (strlen($ini_text) > 0) { |
1264 | 1264 | foreach (preg_split('#[;:]#', $ini_text) as $key => $value) { |
@@ -1279,7 +1279,7 @@ discard block |
||
1279 | 1279 | */ |
1280 | 1280 | public function resolvePath($path, $allowed_dirs) |
1281 | 1281 | { |
1282 | - $this->DebugMessage('resolvePath: ' . $path . ' (allowed_dirs: ' . print_r($allowed_dirs, true) . ')', __FILE__, __LINE__); |
|
1282 | + $this->DebugMessage('resolvePath: '.$path.' (allowed_dirs: '.print_r($allowed_dirs, true).')', __FILE__, __LINE__); |
|
1283 | 1283 | |
1284 | 1284 | // add base path to the top of the list |
1285 | 1285 | if (!$this->config_allow_src_above_docroot) { |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | array_unshift($allowed_dirs, $this->realPathSafe(__DIR__)); |
1290 | 1290 | } else { |
1291 | 1291 | // no checks are needed, offload the work to realpath and forget about it |
1292 | - $this->DebugMessage('resolvePath: checks disabled, returning ' . $this->realPathSafe($path), __FILE__, __LINE__); |
|
1292 | + $this->DebugMessage('resolvePath: checks disabled, returning '.$this->realPathSafe($path), __FILE__, __LINE__); |
|
1293 | 1293 | |
1294 | 1294 | return $this->realPathSafe($path); |
1295 | 1295 | } |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | } |
1300 | 1300 | |
1301 | 1301 | do { |
1302 | - $this->DebugMessage('resolvePath: iteration, path=' . $path . ', base path = ' . $allowed_dirs[0], __FILE__, __LINE__); |
|
1302 | + $this->DebugMessage('resolvePath: iteration, path='.$path.', base path = '.$allowed_dirs[0], __FILE__, __LINE__); |
|
1303 | 1303 | |
1304 | 1304 | $parts = []; |
1305 | 1305 | // do not use "cleaner" foreach version of this loop as later code relies on both $segments and $i |
@@ -1315,10 +1315,10 @@ discard block |
||
1315 | 1315 | } |
1316 | 1316 | } |
1317 | 1317 | |
1318 | - $this->DebugMessage('resolvePath: stop at component ' . $i, __FILE__, __LINE__); |
|
1318 | + $this->DebugMessage('resolvePath: stop at component '.$i, __FILE__, __LINE__); |
|
1319 | 1319 | // test the part up to here |
1320 | 1320 | $path = implode(DIRECTORY_SEPARATOR, $parts); |
1321 | - $this->DebugMessage('resolvePath: stop at path=' . $path, __FILE__, __LINE__); |
|
1321 | + $this->DebugMessage('resolvePath: stop at path='.$path, __FILE__, __LINE__); |
|
1322 | 1322 | if (!$this->matchPath($path, $allowed_dirs)) { |
1323 | 1323 | $this->DebugMessage('resolvePath: no match, returning null', __FILE__, __LINE__); |
1324 | 1324 | |
@@ -1330,7 +1330,7 @@ discard block |
||
1330 | 1330 | } |
1331 | 1331 | // else it's symlink, rewrite path |
1332 | 1332 | $path = readlink($path); |
1333 | - $this->DebugMessage('resolvePath: symlink matched, target=' . $path, __FILE__, __LINE__); |
|
1333 | + $this->DebugMessage('resolvePath: symlink matched, target='.$path, __FILE__, __LINE__); |
|
1334 | 1334 | |
1335 | 1335 | /* |
1336 | 1336 | Replace base path with symlink target. |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | if ($this->config_auto_allow_symlinks) { |
1346 | 1346 | $allowed_dirs[0] = $path; |
1347 | 1347 | } |
1348 | - $path = $path . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, array_slice($segments, $i + 1)); |
|
1348 | + $path = $path.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, array_slice($segments, $i + 1)); |
|
1349 | 1349 | } while (true); |
1350 | 1350 | |
1351 | 1351 | return $path; |
@@ -1365,29 +1365,29 @@ discard block |
||
1365 | 1365 | |
1366 | 1366 | // http://stackoverflow.com/questions/21421569 |
1367 | 1367 | $newfilename = preg_replace('#[\\/]+#', DIRECTORY_SEPARATOR, $filename); |
1368 | - if (!preg_match('#^' . DIRECTORY_SEPARATOR . '#', $newfilename)) { |
|
1369 | - $newfilename = __DIR__ . DIRECTORY_SEPARATOR . $newfilename; |
|
1368 | + if (!preg_match('#^'.DIRECTORY_SEPARATOR.'#', $newfilename)) { |
|
1369 | + $newfilename = __DIR__.DIRECTORY_SEPARATOR.$newfilename; |
|
1370 | 1370 | } |
1371 | 1371 | do { |
1372 | 1372 | $beforeloop = $newfilename; |
1373 | 1373 | |
1374 | 1374 | // Replace all sequences of more than one / with a single one [[ If you're working on a system that treats // at the start of a path as special, make sure you replace multiple / characters at the start with two of them. This is the only place where POSIX allows (but does not mandate) special handling for multiples, in all other cases, multiple / characters are equivalent to a single one.]] |
1375 | - $newfilename = preg_replace('#' . DIRECTORY_SEPARATOR . '+#', DIRECTORY_SEPARATOR, $newfilename); |
|
1375 | + $newfilename = preg_replace('#'.DIRECTORY_SEPARATOR.'+#', DIRECTORY_SEPARATOR, $newfilename); |
|
1376 | 1376 | |
1377 | 1377 | // Replace all occurrences of /./ with / |
1378 | - $newfilename = preg_replace('#' . DIRECTORY_SEPARATOR . '\\.' . DIRECTORY_SEPARATOR . '#', DIRECTORY_SEPARATOR, $newfilename); |
|
1378 | + $newfilename = preg_replace('#'.DIRECTORY_SEPARATOR.'\\.'.DIRECTORY_SEPARATOR.'#', DIRECTORY_SEPARATOR, $newfilename); |
|
1379 | 1379 | |
1380 | 1380 | // Remove ./ if at the start |
1381 | - $newfilename = preg_replace('#^\\.' . DIRECTORY_SEPARATOR . '#', '', $newfilename); |
|
1381 | + $newfilename = preg_replace('#^\\.'.DIRECTORY_SEPARATOR.'#', '', $newfilename); |
|
1382 | 1382 | |
1383 | 1383 | // Remove /. if at the end |
1384 | - $newfilename = preg_replace('#' . DIRECTORY_SEPARATOR . '\\.$#', '', $newfilename); |
|
1384 | + $newfilename = preg_replace('#'.DIRECTORY_SEPARATOR.'\\.$#', '', $newfilename); |
|
1385 | 1385 | |
1386 | 1386 | // Replace /anything/../ with / |
1387 | - $newfilename = preg_replace('#' . DIRECTORY_SEPARATOR . '[^' . DIRECTORY_SEPARATOR . ']+' . DIRECTORY_SEPARATOR . '\\.\\.' . DIRECTORY_SEPARATOR . '#', DIRECTORY_SEPARATOR, $newfilename); |
|
1387 | + $newfilename = preg_replace('#'.DIRECTORY_SEPARATOR.'[^'.DIRECTORY_SEPARATOR.']+'.DIRECTORY_SEPARATOR.'\\.\\.'.DIRECTORY_SEPARATOR.'#', DIRECTORY_SEPARATOR, $newfilename); |
|
1388 | 1388 | |
1389 | 1389 | // Remove /anything/.. if at the end |
1390 | - $newfilename = preg_replace('#' . DIRECTORY_SEPARATOR . '[^' . DIRECTORY_SEPARATOR . ']+' . DIRECTORY_SEPARATOR . '\\.\\.$#', '', $newfilename); |
|
1390 | + $newfilename = preg_replace('#'.DIRECTORY_SEPARATOR.'[^'.DIRECTORY_SEPARATOR.']+'.DIRECTORY_SEPARATOR.'\\.\\.$#', '', $newfilename); |
|
1391 | 1391 | } while ($newfilename != $beforeloop); |
1392 | 1392 | |
1393 | 1393 | return $newfilename; |
@@ -1419,7 +1419,7 @@ discard block |
||
1419 | 1419 | // absolute pathname (Windows) |
1420 | 1420 | $AbsoluteFilename = $filename; |
1421 | 1421 | } elseif ('/' === $filename{0}) { |
1422 | - if (@is_readable($filename) && !@is_readable($this->config_document_root . $filename)) { |
|
1422 | + if (@is_readable($filename) && !@is_readable($this->config_document_root.$filename)) { |
|
1423 | 1423 | |
1424 | 1424 | // absolute filename (*nix) |
1425 | 1425 | $AbsoluteFilename = $filename; |
@@ -1431,40 +1431,40 @@ discard block |
||
1431 | 1431 | } else { |
1432 | 1432 | $AbsoluteFilename = $this->realPathSafe($filename); |
1433 | 1433 | if (@is_readable($AbsoluteFilename)) { |
1434 | - $this->DebugMessage('phpthumb_functions::ApacheLookupURIarray() failed for "' . $filename . '", but the correct filename (' . $AbsoluteFilename . ') seems to have been resolved with $this->realPathSafe($filename)', __FILE__, __LINE__); |
|
1434 | + $this->DebugMessage('phpthumb_functions::ApacheLookupURIarray() failed for "'.$filename.'", but the correct filename ('.$AbsoluteFilename.') seems to have been resolved with $this->realPathSafe($filename)', __FILE__, __LINE__); |
|
1435 | 1435 | } elseif (is_dir(dirname($AbsoluteFilename))) { |
1436 | - $this->DebugMessage('phpthumb_functions::ApacheLookupURIarray() failed for "' . dirname($filename) . '", but the correct directory (' . dirname($AbsoluteFilename) . ') seems to have been resolved with $this->realPathSafe(.)', __FILE__, __LINE__); |
|
1436 | + $this->DebugMessage('phpthumb_functions::ApacheLookupURIarray() failed for "'.dirname($filename).'", but the correct directory ('.dirname($AbsoluteFilename).') seems to have been resolved with $this->realPathSafe(.)', __FILE__, __LINE__); |
|
1437 | 1437 | } else { |
1438 | - return $this->ErrorImage('phpthumb_functions::ApacheLookupURIarray() failed for "' . $filename . '". This has been known to fail on Apache2 - try using the absolute filename for the source image (ex: "/home/user/httpdocs/image.jpg" instead of "/~user/image.jpg")'); |
|
1438 | + return $this->ErrorImage('phpthumb_functions::ApacheLookupURIarray() failed for "'.$filename.'". This has been known to fail on Apache2 - try using the absolute filename for the source image (ex: "/home/user/httpdocs/image.jpg" instead of "/~user/image.jpg")'); |
|
1439 | 1439 | } |
1440 | 1440 | } |
1441 | 1441 | } else { |
1442 | 1442 | |
1443 | 1443 | // relative filename (any OS) |
1444 | - if (preg_match('#^' . preg_quote($this->config_document_root) . '#', $filename)) { |
|
1444 | + if (preg_match('#^'.preg_quote($this->config_document_root).'#', $filename)) { |
|
1445 | 1445 | $AbsoluteFilename = $filename; |
1446 | - $this->DebugMessage('ResolveFilenameToAbsolute() NOT prepending $this->config_document_root (' . $this->config_document_root . ') to $filename (' . $filename . ') resulting in ($AbsoluteFilename = "' . $AbsoluteFilename . '")', __FILE__, __LINE__); |
|
1446 | + $this->DebugMessage('ResolveFilenameToAbsolute() NOT prepending $this->config_document_root ('.$this->config_document_root.') to $filename ('.$filename.') resulting in ($AbsoluteFilename = "'.$AbsoluteFilename.'")', __FILE__, __LINE__); |
|
1447 | 1447 | } else { |
1448 | - $AbsoluteFilename = $this->config_document_root . $filename; |
|
1449 | - $this->DebugMessage('ResolveFilenameToAbsolute() prepending $this->config_document_root (' . $this->config_document_root . ') to $filename (' . $filename . ') resulting in ($AbsoluteFilename = "' . $AbsoluteFilename . '")', __FILE__, __LINE__); |
|
1448 | + $AbsoluteFilename = $this->config_document_root.$filename; |
|
1449 | + $this->DebugMessage('ResolveFilenameToAbsolute() prepending $this->config_document_root ('.$this->config_document_root.') to $filename ('.$filename.') resulting in ($AbsoluteFilename = "'.$AbsoluteFilename.'")', __FILE__, __LINE__); |
|
1450 | 1450 | } |
1451 | 1451 | } |
1452 | 1452 | } else { |
1453 | 1453 | |
1454 | 1454 | // relative to current directory (any OS) |
1455 | - $AbsoluteFilename = __DIR__ . DIRECTORY_SEPARATOR . preg_replace('#[/\\\\]#', DIRECTORY_SEPARATOR, $filename); |
|
1455 | + $AbsoluteFilename = __DIR__.DIRECTORY_SEPARATOR.preg_replace('#[/\\\\]#', DIRECTORY_SEPARATOR, $filename); |
|
1456 | 1456 | |
1457 | 1457 | if ('/~' === substr(dirname(@$_SERVER['PHP_SELF']), 0, 2)) { |
1458 | 1458 | if ($ApacheLookupURIarray = phpthumb_functions::ApacheLookupURIarray(dirname(@$_SERVER['PHP_SELF']))) { |
1459 | - $AbsoluteFilename = $ApacheLookupURIarray['filename'] . DIRECTORY_SEPARATOR . $filename; |
|
1459 | + $AbsoluteFilename = $ApacheLookupURIarray['filename'].DIRECTORY_SEPARATOR.$filename; |
|
1460 | 1460 | } else { |
1461 | - $AbsoluteFilename = $this->realPathSafe('.') . DIRECTORY_SEPARATOR . $filename; |
|
1461 | + $AbsoluteFilename = $this->realPathSafe('.').DIRECTORY_SEPARATOR.$filename; |
|
1462 | 1462 | if (@is_readable($AbsoluteFilename)) { |
1463 | - $this->DebugMessage('phpthumb_functions::ApacheLookupURIarray() failed for "' . dirname(@$_SERVER['PHP_SELF']) . '", but the correct filename (' . $AbsoluteFilename . ') seems to have been resolved with $this->realPathSafe(.)/$filename', __FILE__, __LINE__); |
|
1463 | + $this->DebugMessage('phpthumb_functions::ApacheLookupURIarray() failed for "'.dirname(@$_SERVER['PHP_SELF']).'", but the correct filename ('.$AbsoluteFilename.') seems to have been resolved with $this->realPathSafe(.)/$filename', __FILE__, __LINE__); |
|
1464 | 1464 | } elseif (is_dir(dirname($AbsoluteFilename))) { |
1465 | - $this->DebugMessage('phpthumb_functions::ApacheLookupURIarray() failed for "' . dirname(@$_SERVER['PHP_SELF']) . '", but the correct directory (' . dirname($AbsoluteFilename) . ') seems to have been resolved with $this->realPathSafe(.)', __FILE__, __LINE__); |
|
1465 | + $this->DebugMessage('phpthumb_functions::ApacheLookupURIarray() failed for "'.dirname(@$_SERVER['PHP_SELF']).'", but the correct directory ('.dirname($AbsoluteFilename).') seems to have been resolved with $this->realPathSafe(.)', __FILE__, __LINE__); |
|
1466 | 1466 | } else { |
1467 | - return $this->ErrorImage('phpthumb_functions::ApacheLookupURIarray() failed for "' . dirname(@$_SERVER['PHP_SELF']) . '". This has been known to fail on Apache2 - try using the absolute filename for the source image'); |
|
1467 | + return $this->ErrorImage('phpthumb_functions::ApacheLookupURIarray() failed for "'.dirname(@$_SERVER['PHP_SELF']).'". This has been known to fail on Apache2 - try using the absolute filename for the source image'); |
|
1468 | 1468 | } |
1469 | 1469 | } |
1470 | 1470 | } |
@@ -1480,19 +1480,19 @@ discard block |
||
1480 | 1480 | } |
1481 | 1481 | */ |
1482 | 1482 | if ($this->iswindows) { |
1483 | - $AbsoluteFilename = preg_replace('#^' . preg_quote($this->realPathSafe($this->config_document_root)) . '#i', str_replace('\\', '\\\\', $this->realPathSafe($this->config_document_root)), $AbsoluteFilename); |
|
1483 | + $AbsoluteFilename = preg_replace('#^'.preg_quote($this->realPathSafe($this->config_document_root)).'#i', str_replace('\\', '\\\\', $this->realPathSafe($this->config_document_root)), $AbsoluteFilename); |
|
1484 | 1484 | $AbsoluteFilename = str_replace(DIRECTORY_SEPARATOR, '/', $AbsoluteFilename); |
1485 | 1485 | } |
1486 | 1486 | $AbsoluteFilename = $this->resolvePath($AbsoluteFilename, $this->config_additional_allowed_dirs); |
1487 | 1487 | if (!$this->config_allow_src_above_docroot |
1488 | - && !preg_match('#^' . preg_quote(str_replace(DIRECTORY_SEPARATOR, '/', $this->realPathSafe($this->config_document_root))) . '#', $AbsoluteFilename)) { |
|
1489 | - $this->DebugMessage('!$this->config_allow_src_above_docroot therefore setting "' . $AbsoluteFilename . '" (outside "' . $this->realPathSafe($this->config_document_root) . '") to null', __FILE__, __LINE__); |
|
1488 | + && !preg_match('#^'.preg_quote(str_replace(DIRECTORY_SEPARATOR, '/', $this->realPathSafe($this->config_document_root))).'#', $AbsoluteFilename)) { |
|
1489 | + $this->DebugMessage('!$this->config_allow_src_above_docroot therefore setting "'.$AbsoluteFilename.'" (outside "'.$this->realPathSafe($this->config_document_root).'") to null', __FILE__, __LINE__); |
|
1490 | 1490 | |
1491 | 1491 | return false; |
1492 | 1492 | } |
1493 | 1493 | if (!$this->config_allow_src_above_phpthumb |
1494 | - && !preg_match('#^' . preg_quote(str_replace(DIRECTORY_SEPARATOR, '/', __DIR__)) . '#', $AbsoluteFilename)) { |
|
1495 | - $this->DebugMessage('!$this->config_allow_src_above_phpthumb therefore setting "' . $AbsoluteFilename . '" (outside "' . __DIR__ . '") to null', __FILE__, __LINE__); |
|
1494 | + && !preg_match('#^'.preg_quote(str_replace(DIRECTORY_SEPARATOR, '/', __DIR__)).'#', $AbsoluteFilename)) { |
|
1495 | + $this->DebugMessage('!$this->config_allow_src_above_phpthumb therefore setting "'.$AbsoluteFilename.'" (outside "'.__DIR__.'") to null', __FILE__, __LINE__); |
|
1496 | 1496 | |
1497 | 1497 | return false; |
1498 | 1498 | } |
@@ -1516,10 +1516,10 @@ discard block |
||
1516 | 1516 | if (empty($open_basedirs) || in_array(dirname($filename), $open_basedirs)) { |
1517 | 1517 | $file_exists_cache[$filename] = file_exists($filename); |
1518 | 1518 | } elseif ($this->iswindows) { |
1519 | - $ls_filename = trim(phpthumb_functions::SafeExec('dir /b ' . phpthumb_functions::escapeshellarg_replacement($filename))); |
|
1520 | - $file_exists_cache[$filename] = ($ls_filename == basename($filename)); // command dir /b return only filename without path |
|
1519 | + $ls_filename = trim(phpthumb_functions::SafeExec('dir /b '.phpthumb_functions::escapeshellarg_replacement($filename))); |
|
1520 | + $file_exists_cache[$filename] = ($ls_filename == basename($filename)); // command dir /b return only filename without path |
|
1521 | 1521 | } else { |
1522 | - $ls_filename = trim(phpthumb_functions::SafeExec('ls ' . phpthumb_functions::escapeshellarg_replacement($filename))); |
|
1522 | + $ls_filename = trim(phpthumb_functions::SafeExec('ls '.phpthumb_functions::escapeshellarg_replacement($filename))); |
|
1523 | 1523 | $file_exists_cache[$filename] = ($ls_filename == $filename); |
1524 | 1524 | } |
1525 | 1525 | } |
@@ -1537,7 +1537,7 @@ discard block |
||
1537 | 1537 | if ($this->iswindows) { |
1538 | 1538 | $WhichConvert = false; |
1539 | 1539 | } else { |
1540 | - $IMwhichConvertCacheFilename = $this->config_cache_directory . DIRECTORY_SEPARATOR . 'phpThumbCacheIMwhichConvert.txt'; |
|
1540 | + $IMwhichConvertCacheFilename = $this->config_cache_directory.DIRECTORY_SEPARATOR.'phpThumbCacheIMwhichConvert.txt'; |
|
1541 | 1541 | if (false !== ($cachedwhichconvertstring = @file_get_contents($IMwhichConvertCacheFilename))) { |
1542 | 1542 | $WhichConvert = $cachedwhichconvertstring; |
1543 | 1543 | } else { |
@@ -1563,7 +1563,7 @@ discard block |
||
1563 | 1563 | return $commandline; |
1564 | 1564 | } |
1565 | 1565 | |
1566 | - $IMcommandlineBaseCacheFilename = $this->config_cache_directory . DIRECTORY_SEPARATOR . 'phpThumbCacheIMcommandlineBase.txt'; |
|
1566 | + $IMcommandlineBaseCacheFilename = $this->config_cache_directory.DIRECTORY_SEPARATOR.'phpThumbCacheIMcommandlineBase.txt'; |
|
1567 | 1567 | if (false !== ($commandline = @file_get_contents($IMcommandlineBaseCacheFilename))) { |
1568 | 1568 | return $commandline; |
1569 | 1569 | } |
@@ -1573,19 +1573,19 @@ discard block |
||
1573 | 1573 | if ($this->config_imagemagick_path |
1574 | 1574 | && ($this->config_imagemagick_path != $this->realPathSafe($this->config_imagemagick_path))) { |
1575 | 1575 | if (@is_executable($this->realPathSafe($this->config_imagemagick_path))) { |
1576 | - $this->DebugMessage('Changing $this->config_imagemagick_path (' . $this->config_imagemagick_path . ') to $this->realPathSafe($this->config_imagemagick_path) (' . $this->realPathSafe($this->config_imagemagick_path) . ')', __FILE__, __LINE__); |
|
1576 | + $this->DebugMessage('Changing $this->config_imagemagick_path ('.$this->config_imagemagick_path.') to $this->realPathSafe($this->config_imagemagick_path) ('.$this->realPathSafe($this->config_imagemagick_path).')', __FILE__, __LINE__); |
|
1577 | 1577 | $this->config_imagemagick_path = $this->realPathSafe($this->config_imagemagick_path); |
1578 | 1578 | } else { |
1579 | - $this->DebugMessage('Leaving $this->config_imagemagick_path as (' . $this->config_imagemagick_path . ') because !is_execuatable($this->realPathSafe($this->config_imagemagick_path)) (' . $this->realPathSafe($this->config_imagemagick_path) . ')', __FILE__, __LINE__); |
|
1579 | + $this->DebugMessage('Leaving $this->config_imagemagick_path as ('.$this->config_imagemagick_path.') because !is_execuatable($this->realPathSafe($this->config_imagemagick_path)) ('.$this->realPathSafe($this->config_imagemagick_path).')', __FILE__, __LINE__); |
|
1580 | 1580 | } |
1581 | 1581 | } |
1582 | - $this->DebugMessage(' file_exists(' . $this->config_imagemagick_path . ') = ' . (int)(@file_exists($this->config_imagemagick_path)), __FILE__, __LINE__); |
|
1583 | - $this->DebugMessage('file_exists_ignoreopenbasedir(' . $this->config_imagemagick_path . ') = ' . (int)$this->file_exists_ignoreopenbasedir($this->config_imagemagick_path), __FILE__, __LINE__); |
|
1584 | - $this->DebugMessage(' is_file(' . $this->config_imagemagick_path . ') = ' . (int)(@is_file($this->config_imagemagick_path)), __FILE__, __LINE__); |
|
1585 | - $this->DebugMessage(' is_executable(' . $this->config_imagemagick_path . ') = ' . (int)(@is_executable($this->config_imagemagick_path)), __FILE__, __LINE__); |
|
1582 | + $this->DebugMessage(' file_exists('.$this->config_imagemagick_path.') = '.(int)(@file_exists($this->config_imagemagick_path)), __FILE__, __LINE__); |
|
1583 | + $this->DebugMessage('file_exists_ignoreopenbasedir('.$this->config_imagemagick_path.') = '.(int)$this->file_exists_ignoreopenbasedir($this->config_imagemagick_path), __FILE__, __LINE__); |
|
1584 | + $this->DebugMessage(' is_file('.$this->config_imagemagick_path.') = '.(int)(@is_file($this->config_imagemagick_path)), __FILE__, __LINE__); |
|
1585 | + $this->DebugMessage(' is_executable('.$this->config_imagemagick_path.') = '.(int)(@is_executable($this->config_imagemagick_path)), __FILE__, __LINE__); |
|
1586 | 1586 | |
1587 | 1587 | if ($this->file_exists_ignoreopenbasedir($this->config_imagemagick_path)) { |
1588 | - $this->DebugMessage('using ImageMagick path from $this->config_imagemagick_path (' . $this->config_imagemagick_path . ')', __FILE__, __LINE__); |
|
1588 | + $this->DebugMessage('using ImageMagick path from $this->config_imagemagick_path ('.$this->config_imagemagick_path.')', __FILE__, __LINE__); |
|
1589 | 1589 | if ($this->iswindows) { |
1590 | 1590 | $commandline = substr($this->config_imagemagick_path, 0, 2) |
1591 | 1591 | . ' && cd ' |
@@ -1605,13 +1605,13 @@ discard block |
||
1605 | 1605 | // `which convert` *should* return the path if "convert" exist, or nothing if it doesn't |
1606 | 1606 | // other things *may* get returned, like "sh: convert: not found" or "no convert in /usr/local/bin /usr/sbin /usr/bin /usr/ccs/bin" |
1607 | 1607 | // so only do this if the value returned exists as a file |
1608 | - $this->DebugMessage('using ImageMagick path from `which convert` (' . $which_convert . ')', __FILE__, __LINE__); |
|
1608 | + $this->DebugMessage('using ImageMagick path from `which convert` ('.$which_convert.')', __FILE__, __LINE__); |
|
1609 | 1609 | $commandline = 'convert'; |
1610 | 1610 | } elseif ($IMversion) { |
1611 | - $this->DebugMessage('setting ImageMagick path to $this->config_imagemagick_path (' . $this->config_imagemagick_path . ') [' . $IMversion . ']', __FILE__, __LINE__); |
|
1611 | + $this->DebugMessage('setting ImageMagick path to $this->config_imagemagick_path ('.$this->config_imagemagick_path.') ['.$IMversion.']', __FILE__, __LINE__); |
|
1612 | 1612 | $commandline = $this->config_imagemagick_path; |
1613 | 1613 | } else { |
1614 | - $this->DebugMessage('ImageMagickThumbnailToGD() aborting because cannot find convert in $this->config_imagemagick_path (' . $this->config_imagemagick_path . '), and `which convert` returned (' . $which_convert . ')', __FILE__, __LINE__); |
|
1614 | + $this->DebugMessage('ImageMagickThumbnailToGD() aborting because cannot find convert in $this->config_imagemagick_path ('.$this->config_imagemagick_path.'), and `which convert` returned ('.$which_convert.')', __FILE__, __LINE__); |
|
1615 | 1615 | $commandline = ''; |
1616 | 1616 | } |
1617 | 1617 | } |
@@ -1632,7 +1632,7 @@ discard block |
||
1632 | 1632 | if (null === $versionstring) { |
1633 | 1633 | $versionstring = [0 => false, 1 => false]; |
1634 | 1634 | |
1635 | - $IMversionCacheFilename = $this->config_cache_directory . DIRECTORY_SEPARATOR . 'phpThumbCacheIMversion.txt'; |
|
1635 | + $IMversionCacheFilename = $this->config_cache_directory.DIRECTORY_SEPARATOR.'phpThumbCacheIMversion.txt'; |
|
1636 | 1636 | if ($cachedversionstring = @file_get_contents($IMversionCacheFilename)) { |
1637 | 1637 | $versionstring = explode("\n", $cachedversionstring, 2); |
1638 | 1638 | $versionstring[0] = ($versionstring[0] ?: false); // "false" is stored as an empty string in the cache file |
@@ -1642,18 +1642,18 @@ discard block |
||
1642 | 1642 | $commandline = (null !== $commandline ? $commandline : ''); |
1643 | 1643 | if ($commandline) { |
1644 | 1644 | $commandline .= ' --version'; |
1645 | - $this->DebugMessage('ImageMagick version checked with "' . $commandline . '"', __FILE__, __LINE__); |
|
1645 | + $this->DebugMessage('ImageMagick version checked with "'.$commandline.'"', __FILE__, __LINE__); |
|
1646 | 1646 | $versionstring[1] = trim(phpthumb_functions::SafeExec($commandline)); |
1647 | 1647 | if (preg_match('#^Version: [^0-9]*([ 0-9\\.\\:Q/\\-]+)#i', $versionstring[1], $matches)) { |
1648 | 1648 | $versionstring[0] = trim($matches[1]); |
1649 | 1649 | } else { |
1650 | 1650 | $versionstring[0] = false; |
1651 | - $this->DebugMessage('ImageMagick did not return recognized version string (' . $versionstring[1] . ')', __FILE__, __LINE__); |
|
1651 | + $this->DebugMessage('ImageMagick did not return recognized version string ('.$versionstring[1].')', __FILE__, __LINE__); |
|
1652 | 1652 | } |
1653 | - $this->DebugMessage('ImageMagick convert --version says "' . @$matches[0] . '"', __FILE__, __LINE__); |
|
1653 | + $this->DebugMessage('ImageMagick convert --version says "'.@$matches[0].'"', __FILE__, __LINE__); |
|
1654 | 1654 | } |
1655 | 1655 | |
1656 | - @file_put_contents($IMversionCacheFilename, $versionstring[0] . "\n" . $versionstring[1]); |
|
1656 | + @file_put_contents($IMversionCacheFilename, $versionstring[0]."\n".$versionstring[1]); |
|
1657 | 1657 | } |
1658 | 1658 | } |
1659 | 1659 | |
@@ -1671,7 +1671,7 @@ discard block |
||
1671 | 1671 | $IMoptions = []; |
1672 | 1672 | $commandline = $this->ImageMagickCommandlineBase(); |
1673 | 1673 | if (null !== $commandline) { |
1674 | - $commandline .= ' -help'; |
|
1674 | + $commandline .= ' -help'; |
|
1675 | 1675 | $IMhelp_lines = explode("\n", phpthumb_functions::SafeExec($commandline)); |
1676 | 1676 | foreach ($IMhelp_lines as $line) { |
1677 | 1677 | if (preg_match('#^[\\+\\-]([a-z\\-]+) #', trim($line), $matches)) { |
@@ -1688,10 +1688,10 @@ discard block |
||
1688 | 1688 | break; |
1689 | 1689 | } |
1690 | 1690 | } |
1691 | - $this->DebugMessage('ImageMagickSwitchAvailable(' . implode(';', $switchname) . ') = ' . (int)$allOK . '', __FILE__, __LINE__); |
|
1691 | + $this->DebugMessage('ImageMagickSwitchAvailable('.implode(';', $switchname).') = '.(int)$allOK.'', __FILE__, __LINE__); |
|
1692 | 1692 | } else { |
1693 | 1693 | $allOK = isset($IMoptions[$switchname]); |
1694 | - $this->DebugMessage('ImageMagickSwitchAvailable(' . $switchname . ') = ' . (int)$allOK . '', __FILE__, __LINE__); |
|
1694 | + $this->DebugMessage('ImageMagickSwitchAvailable('.$switchname.') = '.(int)$allOK.'', __FILE__, __LINE__); |
|
1695 | 1695 | } |
1696 | 1696 | |
1697 | 1697 | return $allOK; |
@@ -1707,8 +1707,8 @@ discard block |
||
1707 | 1707 | $IMformatsList = ''; |
1708 | 1708 | $commandline = $this->ImageMagickCommandlineBase(); |
1709 | 1709 | if (null !== $commandline) { |
1710 | - $commandline = dirname($commandline) . DIRECTORY_SEPARATOR . str_replace('convert', 'identify', basename($commandline)); |
|
1711 | - $commandline .= ' -list format'; |
|
1710 | + $commandline = dirname($commandline).DIRECTORY_SEPARATOR.str_replace('convert', 'identify', basename($commandline)); |
|
1711 | + $commandline .= ' -list format'; |
|
1712 | 1712 | $IMformatsList = phpthumb_functions::SafeExec($commandline); |
1713 | 1713 | } |
1714 | 1714 | } |
@@ -1731,9 +1731,9 @@ discard block |
||
1731 | 1731 | fwrite($fp_tempfile, $this->rawImageData); |
1732 | 1732 | fclose($fp_tempfile); |
1733 | 1733 | $this->sourceFilename = $IMtempSourceFilename; |
1734 | - $this->DebugMessage('ImageMagickThumbnailToGD() setting $this->sourceFilename to "' . $IMtempSourceFilename . '" from $this->rawImageData (' . strlen($this->rawImageData) . ' bytes)', __FILE__, __LINE__); |
|
1734 | + $this->DebugMessage('ImageMagickThumbnailToGD() setting $this->sourceFilename to "'.$IMtempSourceFilename.'" from $this->rawImageData ('.strlen($this->rawImageData).' bytes)', __FILE__, __LINE__); |
|
1735 | 1735 | } else { |
1736 | - $this->DebugMessage('ImageMagickThumbnailToGD() FAILED setting $this->sourceFilename to "' . $IMtempSourceFilename . '" (failed to open for writing: "' . $tempfile_open_error . '")', __FILE__, __LINE__); |
|
1736 | + $this->DebugMessage('ImageMagickThumbnailToGD() FAILED setting $this->sourceFilename to "'.$IMtempSourceFilename.'" (failed to open for writing: "'.$tempfile_open_error.'")', __FILE__, __LINE__); |
|
1737 | 1737 | } |
1738 | 1738 | unset($tempfile_open_error, $IMtempSourceFilename); |
1739 | 1739 | |
@@ -1761,13 +1761,13 @@ discard block |
||
1761 | 1761 | // 'ra' may be part of this list, if not a multiple of 90 degrees |
1762 | 1762 | foreach ($UnAllowedParameters as $parameter) { |
1763 | 1763 | if (isset($this->$parameter)) { |
1764 | - $this->DebugMessage('$this->useRawIMoutput=false because "' . $parameter . '" is set', __FILE__, __LINE__); |
|
1764 | + $this->DebugMessage('$this->useRawIMoutput=false because "'.$parameter.'" is set', __FILE__, __LINE__); |
|
1765 | 1765 | $this->useRawIMoutput = false; |
1766 | 1766 | break; |
1767 | 1767 | } |
1768 | 1768 | } |
1769 | 1769 | } |
1770 | - $this->DebugMessage('$this->useRawIMoutput=' . ($this->useRawIMoutput ? 'true' : 'false') . ' after checking $UnAllowedParameters', __FILE__, __LINE__); |
|
1770 | + $this->DebugMessage('$this->useRawIMoutput='.($this->useRawIMoutput ? 'true' : 'false').' after checking $UnAllowedParameters', __FILE__, __LINE__); |
|
1771 | 1771 | $ImageCreateFunction = ''; |
1772 | 1772 | $outputFormat = $this->thumbnailFormat; |
1773 | 1773 | if (phpthumb_functions::gd_version()) { |
@@ -1786,7 +1786,7 @@ discard block |
||
1786 | 1786 | $ImageCreateFunction = 'imagecreatefromjpeg'; |
1787 | 1787 | break; |
1788 | 1788 | default: |
1789 | - $this->DebugMessage('Forcing output to PNG because $this->thumbnailFormat (' . $this->thumbnailFormat . ' is not a GD-supported format)', __FILE__, __LINE__); |
|
1789 | + $this->DebugMessage('Forcing output to PNG because $this->thumbnailFormat ('.$this->thumbnailFormat.' is not a GD-supported format)', __FILE__, __LINE__); |
|
1790 | 1790 | $outputFormat = 'png'; |
1791 | 1791 | $ImageCreateFunction = 'imagecreatefrompng'; |
1792 | 1792 | $this->is_alpha = true; |
@@ -1842,10 +1842,10 @@ discard block |
||
1842 | 1842 | $IMresizeParameter = 'resize'; |
1843 | 1843 | |
1844 | 1844 | // some (older? around 2002) versions of IM won't accept "-resize 100x" but require "-resize 100x100" |
1845 | - $commandline_test = $this->ImageMagickCommandlineBase() . ' logo: -resize 1x ' . phpthumb_functions::escapeshellarg_replacement($IMtempfilename) . ' 2>&1'; |
|
1845 | + $commandline_test = $this->ImageMagickCommandlineBase().' logo: -resize 1x '.phpthumb_functions::escapeshellarg_replacement($IMtempfilename).' 2>&1'; |
|
1846 | 1846 | $IMresult_test = phpthumb_functions::SafeExec($commandline_test); |
1847 | 1847 | $IMuseExplicitImageOutputDimensions = preg_match('#image dimensions are zero#i', $IMresult_test); |
1848 | - $this->DebugMessage('IMuseExplicitImageOutputDimensions = ' . (int)$IMuseExplicitImageOutputDimensions, __FILE__, __LINE__); |
|
1848 | + $this->DebugMessage('IMuseExplicitImageOutputDimensions = '.(int)$IMuseExplicitImageOutputDimensions, __FILE__, __LINE__); |
|
1849 | 1849 | if ($fp_im_temp = @fopen($IMtempfilename, 'wb')) { |
1850 | 1850 | // erase temp image so ImageMagick logo doesn't get output if other processing fails |
1851 | 1851 | fclose($fp_im_temp); |
@@ -1854,27 +1854,27 @@ discard block |
||
1854 | 1854 | |
1855 | 1855 | if (null !== $this->dpi && $this->ImageMagickSwitchAvailable('density')) { |
1856 | 1856 | // for vector source formats only (WMF, PDF, etc) |
1857 | - $commandline .= ' -flatten -density ' . phpthumb_functions::escapeshellarg_replacement($this->dpi); |
|
1857 | + $commandline .= ' -flatten -density '.phpthumb_functions::escapeshellarg_replacement($this->dpi); |
|
1858 | 1858 | } |
1859 | 1859 | ob_start(); |
1860 | 1860 | $getimagesize = getimagesize($this->sourceFilename); |
1861 | 1861 | $GetImageSizeError = ob_get_contents(); |
1862 | 1862 | ob_end_clean(); |
1863 | 1863 | if (is_array($getimagesize)) { |
1864 | - $this->DebugMessage('getimagesize(' . $this->sourceFilename . ') SUCCEEDED: ' . print_r($getimagesize, true), __FILE__, __LINE__); |
|
1864 | + $this->DebugMessage('getimagesize('.$this->sourceFilename.') SUCCEEDED: '.print_r($getimagesize, true), __FILE__, __LINE__); |
|
1865 | 1865 | } else { |
1866 | - $this->DebugMessage('getimagesize(' . $this->sourceFilename . ') FAILED with error "' . $GetImageSizeError . '"', __FILE__, __LINE__); |
|
1866 | + $this->DebugMessage('getimagesize('.$this->sourceFilename.') FAILED with error "'.$GetImageSizeError.'"', __FILE__, __LINE__); |
|
1867 | 1867 | } |
1868 | 1868 | if (is_array($getimagesize)) { |
1869 | - $this->DebugMessage('getimagesize(' . $this->sourceFilename . ') returned [w=' . $getimagesize[0] . ';h=' . $getimagesize[1] . ';f=' . $getimagesize[2] . ']', __FILE__, __LINE__); |
|
1869 | + $this->DebugMessage('getimagesize('.$this->sourceFilename.') returned [w='.$getimagesize[0].';h='.$getimagesize[1].';f='.$getimagesize[2].']', __FILE__, __LINE__); |
|
1870 | 1870 | $this->source_width = $getimagesize[0]; |
1871 | 1871 | $this->source_height = $getimagesize[1]; |
1872 | - $this->DebugMessage('source dimensions set to ' . $this->source_width . 'x' . $this->source_height, __FILE__, __LINE__); |
|
1872 | + $this->DebugMessage('source dimensions set to '.$this->source_width.'x'.$this->source_height, __FILE__, __LINE__); |
|
1873 | 1873 | $this->SetOrientationDependantWidthHeight(); |
1874 | 1874 | |
1875 | - if (!preg_match('#(' . implode('|', $this->AlphaCapableFormats) . ')#i', $outputFormat)) { |
|
1875 | + if (!preg_match('#('.implode('|', $this->AlphaCapableFormats).')#i', $outputFormat)) { |
|
1876 | 1876 | // not a transparency-capable format |
1877 | - $commandline .= ' -background ' . phpthumb_functions::escapeshellarg_replacement('#' . ($this->bg ?: 'FFFFFF')); |
|
1877 | + $commandline .= ' -background '.phpthumb_functions::escapeshellarg_replacement('#'.($this->bg ?: 'FFFFFF')); |
|
1878 | 1878 | if (IMAGETYPE_GIF == $getimagesize[2]) { |
1879 | 1879 | $commandline .= ' -flatten'; |
1880 | 1880 | } |
@@ -1901,8 +1901,8 @@ discard block |
||
1901 | 1901 | $sideX = phpthumb_functions::nonempty_min($this->source_width, $wAll, round($hAll * $zcAR)); |
1902 | 1902 | $sideY = phpthumb_functions::nonempty_min($this->source_height, $hAll, round($wAll / $zcAR)); |
1903 | 1903 | |
1904 | - $thumbnailH = round(max($sideY, ($sideY * $zcAR) / $imAR)); |
|
1905 | - $commandline .= ' -' . $IMresizeParameter . ' ' . phpthumb_functions::escapeshellarg_replacement(($IMuseExplicitImageOutputDimensions ? $thumbnailH : '') . 'x' . $thumbnailH); |
|
1904 | + $thumbnailH = round(max($sideY, ($sideY * $zcAR) / $imAR)); |
|
1905 | + $commandline .= ' -'.$IMresizeParameter.' '.phpthumb_functions::escapeshellarg_replacement(($IMuseExplicitImageOutputDimensions ? $thumbnailH : '').'x'.$thumbnailH); |
|
1906 | 1906 | |
1907 | 1907 | switch (strtoupper($this->zc)) { |
1908 | 1908 | case 'T': |
@@ -1937,26 +1937,26 @@ discard block |
||
1937 | 1937 | } |
1938 | 1938 | |
1939 | 1939 | if (($wAll > 0) && ($hAll > 0)) { |
1940 | - $commandline .= ' -crop ' . phpthumb_functions::escapeshellarg_replacement($wAll . 'x' . $hAll . '+0+0'); |
|
1940 | + $commandline .= ' -crop '.phpthumb_functions::escapeshellarg_replacement($wAll.'x'.$hAll.'+0+0'); |
|
1941 | 1941 | } else { |
1942 | - $commandline .= ' -crop ' . phpthumb_functions::escapeshellarg_replacement($side . 'x' . $side . '+0+0'); |
|
1942 | + $commandline .= ' -crop '.phpthumb_functions::escapeshellarg_replacement($side.'x'.$side.'+0+0'); |
|
1943 | 1943 | } |
1944 | 1944 | if ($this->ImageMagickSwitchAvailable('repage')) { |
1945 | 1945 | $commandline .= ' +repage'; |
1946 | 1946 | } else { |
1947 | - $this->DebugMessage('Skipping "+repage" because ImageMagick (v' . $this->ImageMagickVersion() . ') does not support it', __FILE__, __LINE__); |
|
1947 | + $this->DebugMessage('Skipping "+repage" because ImageMagick (v'.$this->ImageMagickVersion().') does not support it', __FILE__, __LINE__); |
|
1948 | 1948 | } |
1949 | 1949 | } elseif ($this->sw || $this->sh || $this->sx || $this->sy) { |
1950 | 1950 | $crop_param = ''; |
1951 | 1951 | $crop_param .= ($this->sw ? (($this->sw < 2) ? round($this->sw * $this->source_width) : $this->sw) : $this->source_width); |
1952 | - $crop_param .= 'x' . ($this->sh ? (($this->sh < 2) ? round($this->sh * $this->source_height) : $this->sh) : $this->source_height); |
|
1953 | - $crop_param .= '+' . (($this->sx < 2) ? round($this->sx * $this->source_width) : $this->sx); |
|
1954 | - $crop_param .= '+' . (($this->sy < 2) ? round($this->sy * $this->source_height) : $this->sy); |
|
1952 | + $crop_param .= 'x'.($this->sh ? (($this->sh < 2) ? round($this->sh * $this->source_height) : $this->sh) : $this->source_height); |
|
1953 | + $crop_param .= '+'.(($this->sx < 2) ? round($this->sx * $this->source_width) : $this->sx); |
|
1954 | + $crop_param .= '+'.(($this->sy < 2) ? round($this->sy * $this->source_height) : $this->sy); |
|
1955 | 1955 | // TO BE FIXED |
1956 | 1956 | // makes 1x1 output |
1957 | 1957 | // http://trainspotted.com/phpThumb/phpThumb.php?src=/content/CNR/47/CNR-4728-LD-L-20110723-898.jpg&w=100&h=100&far=1&f=png&fltr[]=lvl&sx=0.05&sy=0.25&sw=0.92&sh=0.42 |
1958 | 1958 | // '/usr/bin/convert' -density 150 -thumbnail 100x100 -contrast-stretch '0.1%' '/var/www/vhosts/trainspotted.com/httpdocs/content/CNR/47/CNR-4728-LD-L-20110723-898.jpg[0]' png:'/var/www/vhosts/trainspotted.com/httpdocs/phpThumb/_cache/pThumbIIUlvj' |
1959 | - $commandline .= ' -crop ' . phpthumb_functions::escapeshellarg_replacement($crop_param); |
|
1959 | + $commandline .= ' -crop '.phpthumb_functions::escapeshellarg_replacement($crop_param); |
|
1960 | 1960 | |
1961 | 1961 | // this is broken for aoe=1, but unsure how to fix. Send advice to [email protected] |
1962 | 1962 | if ($this->w || $this->h) { |
@@ -1966,7 +1966,7 @@ discard block |
||
1966 | 1966 | // newer versions of ImageMagick require -repage <geometry> |
1967 | 1967 | $commandline .= ' -repage'; |
1968 | 1968 | } else { |
1969 | - $this->DebugMessage('Skipping "-repage" because ImageMagick (v' . $this->ImageMagickVersion() . ') does not support it', __FILE__, __LINE__); |
|
1969 | + $this->DebugMessage('Skipping "-repage" because ImageMagick (v'.$this->ImageMagickVersion().') does not support it', __FILE__, __LINE__); |
|
1970 | 1970 | } |
1971 | 1971 | if ($IMuseExplicitImageOutputDimensions) { |
1972 | 1972 | if ($this->w && !$this->h) { |
@@ -1975,14 +1975,14 @@ discard block |
||
1975 | 1975 | $this->w = ceil($this->h * ($this->source_width / $this->source_height)); |
1976 | 1976 | } |
1977 | 1977 | } |
1978 | - $commandline .= ' -' . $IMresizeParameter . ' ' . phpthumb_functions::escapeshellarg_replacement($this->w . 'x' . $this->h); |
|
1978 | + $commandline .= ' -'.$IMresizeParameter.' '.phpthumb_functions::escapeshellarg_replacement($this->w.'x'.$this->h); |
|
1979 | 1979 | } |
1980 | 1980 | } else { |
1981 | 1981 | if ($this->iar && ((int)$this->w > 0) && ((int)$this->h > 0)) { |
1982 | 1982 | list($nw, $nh) = phpthumb_functions::TranslateWHbyAngle($this->w, $this->h, $this->ra); |
1983 | 1983 | $nw = ((0 != round($nw)) ? round($nw) : ''); |
1984 | 1984 | $nh = ((0 != round($nh)) ? round($nh) : ''); |
1985 | - $commandline .= ' -' . $IMresizeParameter . ' ' . phpthumb_functions::escapeshellarg_replacement($nw . 'x' . $nh . '!'); |
|
1985 | + $commandline .= ' -'.$IMresizeParameter.' '.phpthumb_functions::escapeshellarg_replacement($nw.'x'.$nh.'!'); |
|
1986 | 1986 | } else { |
1987 | 1987 | $this->w = ((($this->aoe || $this->far) |
1988 | 1988 | && $this->w) ? $this->w : ($this->w ? phpthumb_functions::nonempty_min($this->w, $getimagesize[0]) : '')); |
@@ -1999,21 +1999,21 @@ discard block |
||
1999 | 1999 | list($nw, $nh) = phpthumb_functions::TranslateWHbyAngle($this->w, $this->h, $this->ra); |
2000 | 2000 | $nw = ((0 != round($nw)) ? round($nw) : ''); |
2001 | 2001 | $nh = ((0 != round($nh)) ? round($nh) : ''); |
2002 | - $commandline .= ' -' . $IMresizeParameter . ' ' . phpthumb_functions::escapeshellarg_replacement($nw . 'x' . $nh); |
|
2002 | + $commandline .= ' -'.$IMresizeParameter.' '.phpthumb_functions::escapeshellarg_replacement($nw.'x'.$nh); |
|
2003 | 2003 | } |
2004 | 2004 | } |
2005 | 2005 | } |
2006 | 2006 | } |
2007 | 2007 | } else { |
2008 | - $this->DebugMessage('getimagesize(' . $this->sourceFilename . ') failed', __FILE__, __LINE__); |
|
2008 | + $this->DebugMessage('getimagesize('.$this->sourceFilename.') failed', __FILE__, __LINE__); |
|
2009 | 2009 | if ($this->w || $this->h) { |
2010 | 2010 | $exactDimensionsBang = (($this->iar && ((int)$this->w > 0) |
2011 | 2011 | && ((int)$this->h > 0)) ? '!' : ''); |
2012 | 2012 | if ($IMuseExplicitImageOutputDimensions) { |
2013 | 2013 | // unknown source aspect ratio, just put large number and hope IM figures it out |
2014 | - $commandline .= ' -' . $IMresizeParameter . ' ' . phpthumb_functions::escapeshellarg_replacement(($this->w ?: '9999') . 'x' . ($this->h ?: '9999') . $exactDimensionsBang); |
|
2014 | + $commandline .= ' -'.$IMresizeParameter.' '.phpthumb_functions::escapeshellarg_replacement(($this->w ?: '9999').'x'.($this->h ?: '9999').$exactDimensionsBang); |
|
2015 | 2015 | } else { |
2016 | - $commandline .= ' -' . $IMresizeParameter . ' ' . phpthumb_functions::escapeshellarg_replacement($this->w . 'x' . $this->h . $exactDimensionsBang); |
|
2016 | + $commandline .= ' -'.$IMresizeParameter.' '.phpthumb_functions::escapeshellarg_replacement($this->w.'x'.$this->h.$exactDimensionsBang); |
|
2017 | 2017 | } |
2018 | 2018 | } |
2019 | 2019 | } |
@@ -2021,16 +2021,16 @@ discard block |
||
2021 | 2021 | if ($this->ra) { |
2022 | 2022 | $this->ra = (int)$this->ra; |
2023 | 2023 | if ($this->ImageMagickSwitchAvailable('rotate')) { |
2024 | - if (!preg_match('#(' . implode('|', $this->AlphaCapableFormats) . ')#i', $outputFormat) |
|
2024 | + if (!preg_match('#('.implode('|', $this->AlphaCapableFormats).')#i', $outputFormat) |
|
2025 | 2025 | || phpthumb_functions::version_compare_replacement($this->ImageMagickVersion(), '6.3.7', '>=')) { |
2026 | 2026 | $this->DebugMessage('Using ImageMagick rotate', __FILE__, __LINE__); |
2027 | - $commandline .= ' -rotate ' . phpthumb_functions::escapeshellarg_replacement($this->ra); |
|
2027 | + $commandline .= ' -rotate '.phpthumb_functions::escapeshellarg_replacement($this->ra); |
|
2028 | 2028 | if (0 != ($this->ra % 90)) { |
2029 | - if (preg_match('#(' . implode('|', $this->AlphaCapableFormats) . ')#i', $outputFormat)) { |
|
2029 | + if (preg_match('#('.implode('|', $this->AlphaCapableFormats).')#i', $outputFormat)) { |
|
2030 | 2030 | // alpha-capable format |
2031 | 2031 | $commandline .= ' -background rgba(255,255,255,0)'; |
2032 | 2032 | } else { |
2033 | - $commandline .= ' -background ' . phpthumb_functions::escapeshellarg_replacement('#' . ($this->bg ?: 'FFFFFF')); |
|
2033 | + $commandline .= ' -background '.phpthumb_functions::escapeshellarg_replacement('#'.($this->bg ?: 'FFFFFF')); |
|
2034 | 2034 | } |
2035 | 2035 | } |
2036 | 2036 | $this->ra = 0; |
@@ -2048,7 +2048,7 @@ discard block |
||
2048 | 2048 | switch ($command) { |
2049 | 2049 | case 'brit': |
2050 | 2050 | if ($this->ImageMagickSwitchAvailable('modulate')) { |
2051 | - $commandline .= ' -modulate ' . phpthumb_functions::escapeshellarg_replacement((100 + (int)$parameter) . ',100,100'); |
|
2051 | + $commandline .= ' -modulate '.phpthumb_functions::escapeshellarg_replacement((100 + (int)$parameter).',100,100'); |
|
2052 | 2052 | $successfullyProcessedFilters[] = $filterkey; |
2053 | 2053 | } |
2054 | 2054 | break; |
@@ -2079,7 +2079,7 @@ discard block |
||
2079 | 2079 | $commandline .= ' -colorspace GRAY'; |
2080 | 2080 | $commandline .= ' -modulate 100,0,100'; |
2081 | 2081 | } else { |
2082 | - $commandline .= ' -modulate ' . phpthumb_functions::escapeshellarg_replacement('100,' . (100 - (int)$parameter) . ',100'); |
|
2082 | + $commandline .= ' -modulate '.phpthumb_functions::escapeshellarg_replacement('100,'.(100 - (int)$parameter).',100'); |
|
2083 | 2083 | } |
2084 | 2084 | $successfullyProcessedFilters[] = $filterkey; |
2085 | 2085 | } |
@@ -2091,7 +2091,7 @@ discard block |
||
2091 | 2091 | $commandline .= ' -colorspace GRAY'; |
2092 | 2092 | $commandline .= ' -modulate 100,0,100'; |
2093 | 2093 | } else { |
2094 | - $commandline .= ' -modulate ' . phpthumb_functions::escapeshellarg_replacement('100,' . (100 + (int)$parameter) . ',100'); |
|
2094 | + $commandline .= ' -modulate '.phpthumb_functions::escapeshellarg_replacement('100,'.(100 + (int)$parameter).',100'); |
|
2095 | 2095 | } |
2096 | 2096 | $successfullyProcessedFilters[] = $filterkey; |
2097 | 2097 | } |
@@ -2108,8 +2108,8 @@ discard block |
||
2108 | 2108 | case 'clr': |
2109 | 2109 | if ($this->ImageMagickSwitchAvailable(['fill', 'colorize'])) { |
2110 | 2110 | @list($amount, $color) = explode('|', $parameter); |
2111 | - $commandline .= ' -fill ' . phpthumb_functions::escapeshellarg_replacement('#' . preg_replace('#[^0-9A-F]#i', '', $color)); |
|
2112 | - $commandline .= ' -colorize ' . phpthumb_functions::escapeshellarg_replacement(min(max((int)$amount, 0), 100)); |
|
2111 | + $commandline .= ' -fill '.phpthumb_functions::escapeshellarg_replacement('#'.preg_replace('#[^0-9A-F]#i', '', $color)); |
|
2112 | + $commandline .= ' -colorize '.phpthumb_functions::escapeshellarg_replacement(min(max((int)$amount, 0), 100)); |
|
2113 | 2113 | } |
2114 | 2114 | break; |
2115 | 2115 | |
@@ -2118,7 +2118,7 @@ discard block |
||
2118 | 2118 | @list($amount, $color) = explode('|', $parameter); |
2119 | 2119 | $amount = ($amount ?: 80); |
2120 | 2120 | if (!$color) { |
2121 | - $commandline .= ' -sepia-tone ' . phpthumb_functions::escapeshellarg_replacement(min(max($amount, 0), 100) . '%'); |
|
2121 | + $commandline .= ' -sepia-tone '.phpthumb_functions::escapeshellarg_replacement(min(max($amount, 0), 100).'%'); |
|
2122 | 2122 | $successfullyProcessedFilters[] = $filterkey; |
2123 | 2123 | } |
2124 | 2124 | } |
@@ -2129,7 +2129,7 @@ discard block |
||
2129 | 2129 | $amount = min(max((float)$amount, 0.001), 10); |
2130 | 2130 | if ('1.000' !== number_format($amount, 3)) { |
2131 | 2131 | if ($this->ImageMagickSwitchAvailable('gamma')) { |
2132 | - $commandline .= ' -gamma ' . phpthumb_functions::escapeshellarg_replacement($amount); |
|
2132 | + $commandline .= ' -gamma '.phpthumb_functions::escapeshellarg_replacement($amount); |
|
2133 | 2133 | $successfullyProcessedFilters[] = $filterkey; |
2134 | 2134 | } |
2135 | 2135 | } |
@@ -2137,7 +2137,7 @@ discard block |
||
2137 | 2137 | |
2138 | 2138 | case 'neg': |
2139 | 2139 | if ($this->ImageMagickSwitchAvailable('negate')) { |
2140 | - $commandline .= ' -negate'; |
|
2140 | + $commandline .= ' -negate'; |
|
2141 | 2141 | $successfullyProcessedFilters[] = $filterkey; |
2142 | 2142 | } |
2143 | 2143 | break; |
@@ -2145,7 +2145,7 @@ discard block |
||
2145 | 2145 | case 'th': |
2146 | 2146 | @list($amount) = explode('|', $parameter); |
2147 | 2147 | if ($this->ImageMagickSwitchAvailable(['threshold', 'dither', 'monochrome'])) { |
2148 | - $commandline .= ' -threshold ' . phpthumb_functions::escapeshellarg_replacement(round(min(max((int)$amount, 0), 255) / 2.55) . '%'); |
|
2148 | + $commandline .= ' -threshold '.phpthumb_functions::escapeshellarg_replacement(round(min(max((int)$amount, 0), 255) / 2.55).'%'); |
|
2149 | 2149 | $commandline .= ' -dither'; |
2150 | 2150 | $commandline .= ' -monochrome'; |
2151 | 2151 | $successfullyProcessedFilters[] = $filterkey; |
@@ -2157,7 +2157,7 @@ discard block |
||
2157 | 2157 | @list($colors, $dither) = explode('|', $parameter); |
2158 | 2158 | $colors = ($colors ? (int)$colors : 256); |
2159 | 2159 | $dither = ((strlen($dither) > 0) ? (bool)$dither : true); |
2160 | - $commandline .= ' -colors ' . phpthumb_functions::escapeshellarg_replacement(max($colors, 8)); // ImageMagick will otherwise fail with "cannot quantize to fewer than 8 colors" |
|
2160 | + $commandline .= ' -colors '.phpthumb_functions::escapeshellarg_replacement(max($colors, 8)); // ImageMagick will otherwise fail with "cannot quantize to fewer than 8 colors" |
|
2161 | 2161 | $commandline .= ($dither ? ' -dither' : ' +dither'); |
2162 | 2162 | $successfullyProcessedFilters[] = $filterkey; |
2163 | 2163 | } |
@@ -2178,15 +2178,15 @@ discard block |
||
2178 | 2178 | case 'edge': |
2179 | 2179 | if ($this->ImageMagickSwitchAvailable('edge')) { |
2180 | 2180 | $parameter = (!empty($parameter) ? $parameter : 2); |
2181 | - $commandline .= ' -edge ' . phpthumb_functions::escapeshellarg_replacement(!empty($parameter) ? $parameter : 1); |
|
2181 | + $commandline .= ' -edge '.phpthumb_functions::escapeshellarg_replacement(!empty($parameter) ? $parameter : 1); |
|
2182 | 2182 | $successfullyProcessedFilters[] = $filterkey; |
2183 | 2183 | } |
2184 | 2184 | break; |
2185 | 2185 | |
2186 | 2186 | case 'emb': |
2187 | 2187 | if ($this->ImageMagickSwitchAvailable(['emboss', 'negate'])) { |
2188 | - $parameter = (!empty($parameter) ? $parameter : 2); |
|
2189 | - $commandline .= ' -emboss ' . phpthumb_functions::escapeshellarg_replacement($parameter); |
|
2188 | + $parameter = (!empty($parameter) ? $parameter : 2); |
|
2189 | + $commandline .= ' -emboss '.phpthumb_functions::escapeshellarg_replacement($parameter); |
|
2190 | 2190 | if ($parameter < 2) { |
2191 | 2191 | $commandline .= ' -negate'; // ImageMagick negates the image for some reason with '-emboss 1'; |
2192 | 2192 | } |
@@ -2214,7 +2214,7 @@ discard block |
||
2214 | 2214 | foreach ($this->fltr as $fltr_key => $fltr_value) { |
2215 | 2215 | list($fltr_cmd) = explode('|', $fltr_value); |
2216 | 2216 | if ('wb' === $fltr_cmd) { |
2217 | - $this->DebugMessage('Setting "lvl" filter method to "0" (from "' . $method . '") because white-balance filter also enabled', __FILE__, __LINE__); |
|
2217 | + $this->DebugMessage('Setting "lvl" filter method to "0" (from "'.$method.'") because white-balance filter also enabled', __FILE__, __LINE__); |
|
2218 | 2218 | $method = 0; |
2219 | 2219 | } |
2220 | 2220 | } |
@@ -2227,11 +2227,11 @@ discard block |
||
2227 | 2227 | case 2: // ImageMagick "contrast-stretch" |
2228 | 2228 | if ($this->ImageMagickSwitchAvailable('contrast-stretch')) { |
2229 | 2229 | if ('*' !== $band) { |
2230 | - $commandline .= ' -channel ' . phpthumb_functions::escapeshellarg_replacement(strtoupper($band)); |
|
2230 | + $commandline .= ' -channel '.phpthumb_functions::escapeshellarg_replacement(strtoupper($band)); |
|
2231 | 2231 | } |
2232 | 2232 | $threshold = preg_replace('#[^0-9\\.]#', '', $threshold); // should be unneccesary, but just to be double-sure |
2233 | 2233 | //$commandline .= ' -contrast-stretch '.phpthumb_functions::escapeshellarg_replacement($threshold.'%'); |
2234 | - $commandline .= ' -contrast-stretch \'' . $threshold . '%\''; |
|
2234 | + $commandline .= ' -contrast-stretch \''.$threshold.'%\''; |
|
2235 | 2235 | if ('*' !== $band) { |
2236 | 2236 | $commandline .= ' +channel'; |
2237 | 2237 | } |
@@ -2241,7 +2241,7 @@ discard block |
||
2241 | 2241 | case 3: // ImageMagick "normalize" |
2242 | 2242 | if ($this->ImageMagickSwitchAvailable('normalize')) { |
2243 | 2243 | if ('*' !== $band) { |
2244 | - $commandline .= ' -channel ' . phpthumb_functions::escapeshellarg_replacement(strtoupper($band)); |
|
2244 | + $commandline .= ' -channel '.phpthumb_functions::escapeshellarg_replacement(strtoupper($band)); |
|
2245 | 2245 | } |
2246 | 2246 | $commandline .= ' -normalize'; |
2247 | 2247 | if ('*' !== $band) { |
@@ -2251,12 +2251,12 @@ discard block |
||
2251 | 2251 | } |
2252 | 2252 | break; |
2253 | 2253 | default: |
2254 | - $this->DebugMessage('unsupported method (' . $method . ') for "lvl" filter', __FILE__, __LINE__); |
|
2254 | + $this->DebugMessage('unsupported method ('.$method.') for "lvl" filter', __FILE__, __LINE__); |
|
2255 | 2255 | break; |
2256 | 2256 | } |
2257 | 2257 | if (isset($this->fltr[$filterkey]) && ($method > 1)) { |
2258 | - $this->fltr[$filterkey] = $command . '|' . $band . '|0|' . $threshold; |
|
2259 | - $this->DebugMessage('filter "lvl" remapped from method "' . $method . '" to method "0" because ImageMagick support is missing', __FILE__, __LINE__); |
|
2258 | + $this->fltr[$filterkey] = $command.'|'.$band.'|0|'.$threshold; |
|
2259 | + $this->DebugMessage('filter "lvl" remapped from method "'.$method.'" to method "0" because ImageMagick support is missing', __FILE__, __LINE__); |
|
2260 | 2260 | } |
2261 | 2261 | break; |
2262 | 2262 | |
@@ -2268,9 +2268,9 @@ discard block |
||
2268 | 2268 | //$commandline .= ' -channel R -contrast-stretch '.phpthumb_functions::escapeshellarg_replacement($threshold.'%'); // doesn't work on Windows because most versions of PHP do not properly |
2269 | 2269 | //$commandline .= ' -channel G -contrast-stretch '.phpthumb_functions::escapeshellarg_replacement($threshold.'%'); // escape special characters (such as %) and just replace them with spaces |
2270 | 2270 | //$commandline .= ' -channel B -contrast-stretch '.phpthumb_functions::escapeshellarg_replacement($threshold.'%'); // https://bugs.php.net/bug.php?id=43261 |
2271 | - $commandline .= ' -channel R -contrast-stretch \'' . $threshold . '%\''; |
|
2272 | - $commandline .= ' -channel G -contrast-stretch \'' . $threshold . '%\''; |
|
2273 | - $commandline .= ' -channel B -contrast-stretch \'' . $threshold . '%\''; |
|
2271 | + $commandline .= ' -channel R -contrast-stretch \''.$threshold.'%\''; |
|
2272 | + $commandline .= ' -channel G -contrast-stretch \''.$threshold.'%\''; |
|
2273 | + $commandline .= ' -channel B -contrast-stretch \''.$threshold.'%\''; |
|
2274 | 2274 | $commandline .= ' +channel'; |
2275 | 2275 | $successfullyProcessedFilters[] = $filterkey; |
2276 | 2276 | } |
@@ -2280,7 +2280,7 @@ discard block |
||
2280 | 2280 | if ($this->ImageMagickSwitchAvailable('blur')) { |
2281 | 2281 | @list($radius) = explode('|', $parameter); |
2282 | 2282 | $radius = (!empty($radius) ? min(max((int)$radius, 0), 25) : 1); |
2283 | - $commandline .= ' -blur ' . phpthumb_functions::escapeshellarg_replacement($radius); |
|
2283 | + $commandline .= ' -blur '.phpthumb_functions::escapeshellarg_replacement($radius); |
|
2284 | 2284 | $successfullyProcessedFilters[] = $filterkey; |
2285 | 2285 | } |
2286 | 2286 | break; |
@@ -2290,10 +2290,10 @@ discard block |
||
2290 | 2290 | $radius = (!empty($radius) ? min(max((int)$radius, 0), 25) : 1); |
2291 | 2291 | // "-gaussian" changed to "-gaussian-blur" sometime around 2009 |
2292 | 2292 | if ($this->ImageMagickSwitchAvailable('gaussian-blur')) { |
2293 | - $commandline .= ' -gaussian-blur ' . phpthumb_functions::escapeshellarg_replacement($radius); |
|
2293 | + $commandline .= ' -gaussian-blur '.phpthumb_functions::escapeshellarg_replacement($radius); |
|
2294 | 2294 | $successfullyProcessedFilters[] = $filterkey; |
2295 | 2295 | } elseif ($this->ImageMagickSwitchAvailable('gaussian')) { |
2296 | - $commandline .= ' -gaussian ' . phpthumb_functions::escapeshellarg_replacement($radius); |
|
2296 | + $commandline .= ' -gaussian '.phpthumb_functions::escapeshellarg_replacement($radius); |
|
2297 | 2297 | $successfullyProcessedFilters[] = $filterkey; |
2298 | 2298 | } |
2299 | 2299 | break; |
@@ -2304,7 +2304,7 @@ discard block |
||
2304 | 2304 | $amount = ($amount ? min(max((int)$radius, 0), 255) : 80); |
2305 | 2305 | $radius = ($radius ? min(max((int)$radius, 0), 10) : 0.5); |
2306 | 2306 | $threshold = (strlen($threshold) ? min(max((int)$radius, 0), 50) : 3); |
2307 | - $commandline .= ' -unsharp ' . phpthumb_functions::escapeshellarg_replacement(number_format(($radius * 2) - 1, 2, '.', '') . 'x1+' . number_format($amount / 100, 2, '.', '') . '+' . number_format($threshold / 100, 2, '.', '')); |
|
2307 | + $commandline .= ' -unsharp '.phpthumb_functions::escapeshellarg_replacement(number_format(($radius * 2) - 1, 2, '.', '').'x1+'.number_format($amount / 100, 2, '.', '').'+'.number_format($threshold / 100, 2, '.', '')); |
|
2308 | 2308 | $successfullyProcessedFilters[] = $filterkey; |
2309 | 2309 | } |
2310 | 2310 | break; |
@@ -2326,15 +2326,15 @@ discard block |
||
2326 | 2326 | $color = ((!empty($this->bc) |
2327 | 2327 | && phpthumb_functions::IsHexColor($this->bc)) ? $this->bc : '000000'); |
2328 | 2328 | } |
2329 | - $commandline .= ' -border ' . phpthumb_functions::escapeshellarg_replacement($width); |
|
2330 | - $commandline .= ' -bordercolor ' . phpthumb_functions::escapeshellarg_replacement('#' . $color); |
|
2329 | + $commandline .= ' -border '.phpthumb_functions::escapeshellarg_replacement($width); |
|
2330 | + $commandline .= ' -bordercolor '.phpthumb_functions::escapeshellarg_replacement('#'.$color); |
|
2331 | 2331 | |
2332 | 2332 | if (preg_match('# \\-crop "([0-9]+)x([0-9]+)\\+0\\+0" #', $commandline, $matches)) { |
2333 | - $commandline = str_replace(' -crop "' . $matches[1] . 'x' . $matches[2] . '+0+0" ', ' -crop ' . phpthumb_functions::escapeshellarg_replacement(($matches[1] - (2 * $width)) . 'x' . ($matches[2] - (2 * $width)) . '+0+0') . ' ', $commandline); |
|
2334 | - } elseif (preg_match('# \\-' . $IMresizeParameter . ' "([0-9]+)x([0-9]+)" #', $commandline, $matches)) { |
|
2333 | + $commandline = str_replace(' -crop "'.$matches[1].'x'.$matches[2].'+0+0" ', ' -crop '.phpthumb_functions::escapeshellarg_replacement(($matches[1] - (2 * $width)).'x'.($matches[2] - (2 * $width)).'+0+0').' ', $commandline); |
|
2334 | + } elseif (preg_match('# \\-'.$IMresizeParameter.' "([0-9]+)x([0-9]+)" #', $commandline, $matches)) { |
|
2335 | 2335 | $commandline = str_replace( |
2336 | - ' -' . $IMresizeParameter . ' "' . $matches[1] . 'x' . $matches[2] . '" ', |
|
2337 | - ' -' . $IMresizeParameter . ' ' . phpthumb_functions::escapeshellarg_replacement(($matches[1] - (2 * $width)) . 'x' . ($matches[2] - (2 * $width))) . ' ', |
|
2336 | + ' -'.$IMresizeParameter.' "'.$matches[1].'x'.$matches[2].'" ', |
|
2337 | + ' -'.$IMresizeParameter.' '.phpthumb_functions::escapeshellarg_replacement(($matches[1] - (2 * $width)).'x'.($matches[2] - (2 * $width))).' ', |
|
2338 | 2338 | $commandline |
2339 | 2339 | ); |
2340 | 2340 | } |
@@ -2393,43 +2393,43 @@ discard block |
||
2393 | 2393 | break; |
2394 | 2394 | |
2395 | 2395 | default: |
2396 | - $this->DebugMessage('Unknown $this->fltr[' . $filterkey . '] (' . $filtercommand . ') -- deleting filter command', __FILE__, __LINE__); |
|
2396 | + $this->DebugMessage('Unknown $this->fltr['.$filterkey.'] ('.$filtercommand.') -- deleting filter command', __FILE__, __LINE__); |
|
2397 | 2397 | $successfullyProcessedFilters[] = $filterkey; |
2398 | 2398 | break; |
2399 | 2399 | } |
2400 | 2400 | if (!isset($this->fltr[$filterkey])) { |
2401 | - $this->DebugMessage('Processed $this->fltr[' . $filterkey . '] (' . $filtercommand . ') with ImageMagick', __FILE__, __LINE__); |
|
2401 | + $this->DebugMessage('Processed $this->fltr['.$filterkey.'] ('.$filtercommand.') with ImageMagick', __FILE__, __LINE__); |
|
2402 | 2402 | } else { |
2403 | - $this->DebugMessage('Skipping $this->fltr[' . $filterkey . '] (' . $filtercommand . ') with ImageMagick', __FILE__, __LINE__); |
|
2403 | + $this->DebugMessage('Skipping $this->fltr['.$filterkey.'] ('.$filtercommand.') with ImageMagick', __FILE__, __LINE__); |
|
2404 | 2404 | } |
2405 | 2405 | } |
2406 | - $this->DebugMessage('Remaining $this->fltr after ImageMagick: (' . $this->phpThumbDebugVarDump($this->fltr) . ')', __FILE__, __LINE__); |
|
2406 | + $this->DebugMessage('Remaining $this->fltr after ImageMagick: ('.$this->phpThumbDebugVarDump($this->fltr).')', __FILE__, __LINE__); |
|
2407 | 2407 | if (count($this->fltr) > 0) { |
2408 | 2408 | $this->useRawIMoutput = false; |
2409 | 2409 | } |
2410 | 2410 | |
2411 | 2411 | if (preg_match('#jpe?g#i', $outputFormat) && $this->q) { |
2412 | 2412 | if ($this->ImageMagickSwitchAvailable(['quality', 'interlace'])) { |
2413 | - $commandline .= ' -quality ' . phpthumb_functions::escapeshellarg_replacement($this->thumbnailQuality); |
|
2413 | + $commandline .= ' -quality '.phpthumb_functions::escapeshellarg_replacement($this->thumbnailQuality); |
|
2414 | 2414 | if ($this->config_output_interlace) { |
2415 | 2415 | // causes weird things with animated GIF... leave for JPEG only |
2416 | 2416 | $commandline .= ' -interlace line '; // Use Line or Plane to create an interlaced PNG or GIF or progressive JPEG image |
2417 | 2417 | } |
2418 | 2418 | } |
2419 | 2419 | } |
2420 | - $commandline .= ' ' . phpthumb_functions::escapeshellarg_replacement(preg_replace('#[/\\\\]#', DIRECTORY_SEPARATOR, $this->sourceFilename) . (('gif' === $outputFormat) ? '' : '[' . (int)$this->sfn . ']')); // [0] means first frame of (GIF) animation, can be ignored |
|
2421 | - $commandline .= ' ' . $outputFormat . ':' . phpthumb_functions::escapeshellarg_replacement($IMtempfilename); |
|
2420 | + $commandline .= ' '.phpthumb_functions::escapeshellarg_replacement(preg_replace('#[/\\\\]#', DIRECTORY_SEPARATOR, $this->sourceFilename).(('gif' === $outputFormat) ? '' : '['.(int)$this->sfn.']')); // [0] means first frame of (GIF) animation, can be ignored |
|
2421 | + $commandline .= ' '.$outputFormat.':'.phpthumb_functions::escapeshellarg_replacement($IMtempfilename); |
|
2422 | 2422 | if (!$this->iswindows) { |
2423 | 2423 | $commandline .= ' 2>&1'; |
2424 | 2424 | } |
2425 | - $this->DebugMessage('ImageMagick called as (' . $commandline . ')', __FILE__, __LINE__); |
|
2425 | + $this->DebugMessage('ImageMagick called as ('.$commandline.')', __FILE__, __LINE__); |
|
2426 | 2426 | $IMresult = phpthumb_functions::SafeExec($commandline); |
2427 | 2427 | clearstatcache(); |
2428 | 2428 | if (!@file_exists($IMtempfilename) || !@filesize($IMtempfilename)) { |
2429 | - $this->FatalError('ImageMagick failed with message (' . trim($IMresult) . ')'); |
|
2430 | - $this->DebugMessage('ImageMagick failed with message (' . trim($IMresult) . ')', __FILE__, __LINE__); |
|
2429 | + $this->FatalError('ImageMagick failed with message ('.trim($IMresult).')'); |
|
2430 | + $this->DebugMessage('ImageMagick failed with message ('.trim($IMresult).')', __FILE__, __LINE__); |
|
2431 | 2431 | if ($this->iswindows && !$IMresult) { |
2432 | - $this->DebugMessage('Check to make sure that PHP has read+write permissions to "' . dirname($IMtempfilename) . '"', __FILE__, __LINE__); |
|
2432 | + $this->DebugMessage('Check to make sure that PHP has read+write permissions to "'.dirname($IMtempfilename).'"', __FILE__, __LINE__); |
|
2433 | 2433 | } |
2434 | 2434 | } else { |
2435 | 2435 | foreach ($successfullyProcessedFilters as $dummy => $filterkey) { |
@@ -2437,7 +2437,7 @@ discard block |
||
2437 | 2437 | } |
2438 | 2438 | $this->IMresizedData = file_get_contents($IMtempfilename); |
2439 | 2439 | $getimagesize_imresized = @getimagesize($IMtempfilename); |
2440 | - $this->DebugMessage('getimagesize(' . $IMtempfilename . ') returned [w=' . $getimagesize_imresized[0] . ';h=' . $getimagesize_imresized[1] . ';f=' . $getimagesize_imresized[2] . ']', __FILE__, __LINE__); |
|
2440 | + $this->DebugMessage('getimagesize('.$IMtempfilename.') returned [w='.$getimagesize_imresized[0].';h='.$getimagesize_imresized[1].';f='.$getimagesize_imresized[2].']', __FILE__, __LINE__); |
|
2441 | 2441 | if (($this->config_max_source_pixels > 0) |
2442 | 2442 | && (($getimagesize_imresized[0] * $getimagesize_imresized[1]) > $this->config_max_source_pixels)) { |
2443 | 2443 | $this->DebugMessage('skipping ImageMagickThumbnailToGD::' |
@@ -2455,21 +2455,21 @@ discard block |
||
2455 | 2455 | && ($this->gdimg_source = @$ImageCreateFunction($IMtempfilename))) { |
2456 | 2456 | $this->source_width = imagesx($this->gdimg_source); |
2457 | 2457 | $this->source_height = imagesy($this->gdimg_source); |
2458 | - $this->DebugMessage('ImageMagickThumbnailToGD::' . $ImageCreateFunction . '() succeeded, $this->gdimg_source is now (' . $this->source_width . 'x' . $this->source_height . ')', __FILE__, __LINE__); |
|
2459 | - $this->DebugMessage('ImageMagickThumbnailToGD() returning $this->IMresizedData (' . strlen($this->IMresizedData) . ' bytes)', __FILE__, __LINE__); |
|
2458 | + $this->DebugMessage('ImageMagickThumbnailToGD::'.$ImageCreateFunction.'() succeeded, $this->gdimg_source is now ('.$this->source_width.'x'.$this->source_height.')', __FILE__, __LINE__); |
|
2459 | + $this->DebugMessage('ImageMagickThumbnailToGD() returning $this->IMresizedData ('.strlen($this->IMresizedData).' bytes)', __FILE__, __LINE__); |
|
2460 | 2460 | } else { |
2461 | 2461 | $this->useRawIMoutput = true; |
2462 | - $this->DebugMessage('$this->useRawIMoutput set to TRUE because ' . @$ImageCreateFunction . '(' . $IMtempfilename . ') failed', __FILE__, __LINE__); |
|
2462 | + $this->DebugMessage('$this->useRawIMoutput set to TRUE because '.@$ImageCreateFunction.'('.$IMtempfilename.') failed', __FILE__, __LINE__); |
|
2463 | 2463 | } |
2464 | 2464 | if (file_exists($IMtempfilename)) { |
2465 | - $this->DebugMessage('deleting "' . $IMtempfilename . '"', __FILE__, __LINE__); |
|
2465 | + $this->DebugMessage('deleting "'.$IMtempfilename.'"', __FILE__, __LINE__); |
|
2466 | 2466 | @unlink($IMtempfilename); |
2467 | 2467 | } |
2468 | 2468 | |
2469 | 2469 | return true; |
2470 | 2470 | } |
2471 | 2471 | if (file_exists($IMtempfilename)) { |
2472 | - $this->DebugMessage('deleting "' . $IMtempfilename . '"', __FILE__, __LINE__); |
|
2472 | + $this->DebugMessage('deleting "'.$IMtempfilename.'"', __FILE__, __LINE__); |
|
2473 | 2473 | @unlink($IMtempfilename); |
2474 | 2474 | } |
2475 | 2475 | } elseif ($this->issafemode) { |
@@ -2477,7 +2477,7 @@ discard block |
||
2477 | 2477 | $this->useRawIMoutput = false; |
2478 | 2478 | } else { |
2479 | 2479 | if (file_exists($IMtempfilename)) { |
2480 | - $this->DebugMessage('deleting "' . $IMtempfilename . '"', __FILE__, __LINE__); |
|
2480 | + $this->DebugMessage('deleting "'.$IMtempfilename.'"', __FILE__, __LINE__); |
|
2481 | 2481 | @unlink($IMtempfilename); |
2482 | 2482 | } |
2483 | 2483 | $this->DebugMessage('ImageMagickThumbnailToGD() aborting, phpThumb_tempnam() failed', __FILE__, __LINE__); |
@@ -2501,15 +2501,15 @@ discard block |
||
2501 | 2501 | |
2502 | 2502 | return false; |
2503 | 2503 | } |
2504 | - if (!require_once __DIR__ . '/phpthumb.filters.php') { |
|
2505 | - $this->DebugMessage('Error including "' . __DIR__ . '/phpthumb.filters.php" which is required for applying filters (' . implode(';', $this->fltr) . ')', __FILE__, __LINE__); |
|
2504 | + if (!require_once __DIR__.'/phpthumb.filters.php') { |
|
2505 | + $this->DebugMessage('Error including "'.__DIR__.'/phpthumb.filters.php" which is required for applying filters ('.implode(';', $this->fltr).')', __FILE__, __LINE__); |
|
2506 | 2506 | |
2507 | 2507 | return false; |
2508 | 2508 | } |
2509 | 2509 | |
2510 | 2510 | $this->config_background_hexcolor = ($this->bg ?: $this->config_background_hexcolor); |
2511 | 2511 | if (!phpthumb_functions::IsHexColor($this->config_background_hexcolor)) { |
2512 | - return $this->ErrorImage('Invalid hex color string "' . $this->config_background_hexcolor . '" for parameter "bg"'); |
|
2512 | + return $this->ErrorImage('Invalid hex color string "'.$this->config_background_hexcolor.'" for parameter "bg"'); |
|
2513 | 2513 | } |
2514 | 2514 | |
2515 | 2515 | $rotate_angle = 0; |
@@ -2537,14 +2537,14 @@ discard block |
||
2537 | 2537 | break; |
2538 | 2538 | |
2539 | 2539 | default: |
2540 | - $this->DebugMessage('EXIF auto-rotate failed because unknown $exif_data[Orientation] "' . @$exif_data['Orientation'] . '"', __FILE__, __LINE__); |
|
2540 | + $this->DebugMessage('EXIF auto-rotate failed because unknown $exif_data[Orientation] "'.@$exif_data['Orientation'].'"', __FILE__, __LINE__); |
|
2541 | 2541 | |
2542 | 2542 | return false; |
2543 | 2543 | break; |
2544 | 2544 | } |
2545 | - $this->DebugMessage('EXIF auto-rotate set to ' . $rotate_angle . ' degrees ($exif_data[Orientation] = "' . @$exif_data['Orientation'] . '")', __FILE__, __LINE__); |
|
2545 | + $this->DebugMessage('EXIF auto-rotate set to '.$rotate_angle.' degrees ($exif_data[Orientation] = "'.@$exif_data['Orientation'].'")', __FILE__, __LINE__); |
|
2546 | 2546 | } else { |
2547 | - $this->DebugMessage('failed: exif_read_data(' . $this->sourceFilename . ')', __FILE__, __LINE__); |
|
2547 | + $this->DebugMessage('failed: exif_read_data('.$this->sourceFilename.')', __FILE__, __LINE__); |
|
2548 | 2548 | |
2549 | 2549 | return false; |
2550 | 2550 | } |
@@ -2559,7 +2559,7 @@ discard block |
||
2559 | 2559 | return false; |
2560 | 2560 | } |
2561 | 2561 | } else { |
2562 | - $this->DebugMessage('Cannot auto-rotate from EXIF data because PHP is less than v4.2.0 (' . PHP_VERSION . ')', __FILE__, __LINE__); |
|
2562 | + $this->DebugMessage('Cannot auto-rotate from EXIF data because PHP is less than v4.2.0 ('.PHP_VERSION.')', __FILE__, __LINE__); |
|
2563 | 2563 | |
2564 | 2564 | return false; |
2565 | 2565 | } |
@@ -2639,7 +2639,7 @@ discard block |
||
2639 | 2639 | $starpos = strpos($valid_domain, '*'); |
2640 | 2640 | if (false !== $starpos) { |
2641 | 2641 | $valid_domain = substr($valid_domain, $starpos + 1); |
2642 | - if (preg_match('#' . preg_quote($valid_domain) . '$#', $hostname)) { |
|
2642 | + if (preg_match('#'.preg_quote($valid_domain).'$#', $hostname)) { |
|
2643 | 2643 | $domain_is_allowed[$hostname] = true; |
2644 | 2644 | break; |
2645 | 2645 | } |
@@ -2665,7 +2665,7 @@ discard block |
||
2665 | 2665 | if ($allow && $this->config_nooffsitelink_enabled |
2666 | 2666 | && (@$_SERVER['HTTP_REFERER'] |
2667 | 2667 | || $this->config_nooffsitelink_require_refer)) { |
2668 | - $this->DebugMessage('AntiOffsiteLinking() checking $_SERVER[HTTP_REFERER] "' . @$_SERVER['HTTP_REFERER'] . '"', __FILE__, __LINE__); |
|
2668 | + $this->DebugMessage('AntiOffsiteLinking() checking $_SERVER[HTTP_REFERER] "'.@$_SERVER['HTTP_REFERER'].'"', __FILE__, __LINE__); |
|
2669 | 2669 | foreach ($this->config_nooffsitelink_valid_domains as $key => $valid_domain) { |
2670 | 2670 | // $_SERVER['HTTP_HOST'] contains the port number, so strip it out here to make default configuration work |
2671 | 2671 | list($clean_domain) = explode(':', $valid_domain); |
@@ -2675,9 +2675,9 @@ discard block |
||
2675 | 2675 | if (!$this->OffsiteDomainIsAllowed(@$parsed_url['host'], $this->config_nooffsitelink_valid_domains)) { |
2676 | 2676 | $allow = false; |
2677 | 2677 | //$this->DebugMessage('AntiOffsiteLinking() - "'.@$parsed_url['host'].'" is NOT in $this->config_nooffsitelink_valid_domains ('.implode(';', $this->config_nooffsitelink_valid_domains).')', __FILE__, __LINE__); |
2678 | - $this->ErrorImage('AntiOffsiteLinking() - "' . @$parsed_url['host'] . '" is NOT in $this->config_nooffsitelink_valid_domains (' . implode(';', $this->config_nooffsitelink_valid_domains) . ')'); |
|
2678 | + $this->ErrorImage('AntiOffsiteLinking() - "'.@$parsed_url['host'].'" is NOT in $this->config_nooffsitelink_valid_domains ('.implode(';', $this->config_nooffsitelink_valid_domains).')'); |
|
2679 | 2679 | } else { |
2680 | - $this->DebugMessage('AntiOffsiteLinking() - "' . @$parsed_url['host'] . '" is in $this->config_nooffsitelink_valid_domains (' . implode(';', $this->config_nooffsitelink_valid_domains) . ')', __FILE__, __LINE__); |
|
2680 | + $this->DebugMessage('AntiOffsiteLinking() - "'.@$parsed_url['host'].'" is in $this->config_nooffsitelink_valid_domains ('.implode(';', $this->config_nooffsitelink_valid_domains).')', __FILE__, __LINE__); |
|
2681 | 2681 | } |
2682 | 2682 | } |
2683 | 2683 | |
@@ -2687,9 +2687,9 @@ discard block |
||
2687 | 2687 | if (!$this->OffsiteDomainIsAllowed(@$parsed_url['host'], $this->config_nohotlink_valid_domains)) { |
2688 | 2688 | // This domain is not allowed |
2689 | 2689 | $allow = false; |
2690 | - $this->DebugMessage('AntiOffsiteLinking() - "' . $parsed_url['host'] . '" is NOT in $this->config_nohotlink_valid_domains (' . implode(';', $this->config_nohotlink_valid_domains) . ')', __FILE__, __LINE__); |
|
2690 | + $this->DebugMessage('AntiOffsiteLinking() - "'.$parsed_url['host'].'" is NOT in $this->config_nohotlink_valid_domains ('.implode(';', $this->config_nohotlink_valid_domains).')', __FILE__, __LINE__); |
|
2691 | 2691 | } else { |
2692 | - $this->DebugMessage('AntiOffsiteLinking() - "' . $parsed_url['host'] . '" is in $this->config_nohotlink_valid_domains (' . implode(';', $this->config_nohotlink_valid_domains) . ')', __FILE__, __LINE__); |
|
2692 | + $this->DebugMessage('AntiOffsiteLinking() - "'.$parsed_url['host'].'" is in $this->config_nohotlink_valid_domains ('.implode(';', $this->config_nohotlink_valid_domains).')', __FILE__, __LINE__); |
|
2693 | 2693 | } |
2694 | 2694 | } |
2695 | 2695 | |
@@ -2700,24 +2700,24 @@ discard block |
||
2700 | 2700 | } |
2701 | 2701 | |
2702 | 2702 | if (!phpthumb_functions::IsHexColor($this->config_error_bgcolor)) { |
2703 | - return $this->ErrorImage('Invalid hex color string "' . $this->config_error_bgcolor . '" for $this->config_error_bgcolor'); |
|
2703 | + return $this->ErrorImage('Invalid hex color string "'.$this->config_error_bgcolor.'" for $this->config_error_bgcolor'); |
|
2704 | 2704 | } |
2705 | 2705 | if (!phpthumb_functions::IsHexColor($this->config_error_textcolor)) { |
2706 | - return $this->ErrorImage('Invalid hex color string "' . $this->config_error_textcolor . '" for $this->config_error_textcolor'); |
|
2706 | + return $this->ErrorImage('Invalid hex color string "'.$this->config_error_textcolor.'" for $this->config_error_textcolor'); |
|
2707 | 2707 | } |
2708 | 2708 | if ($this->config_nooffsitelink_erase_image) { |
2709 | 2709 | return $this->ErrorImage($this->config_nooffsitelink_text_message, $this->thumbnail_width, $this->thumbnail_height); |
2710 | 2710 | } else { |
2711 | 2711 | $this->config_nooffsitelink_watermark_src = $this->ResolveFilenameToAbsolute($this->config_nooffsitelink_watermark_src); |
2712 | 2712 | if (is_file($this->config_nooffsitelink_watermark_src)) { |
2713 | - if (!require_once __DIR__ . '/phpthumb.filters.php') { |
|
2714 | - $this->DebugMessage('Error including "' . __DIR__ . '/phpthumb.filters.php" which is required for applying watermark', __FILE__, __LINE__); |
|
2713 | + if (!require_once __DIR__.'/phpthumb.filters.php') { |
|
2714 | + $this->DebugMessage('Error including "'.__DIR__.'/phpthumb.filters.php" which is required for applying watermark', __FILE__, __LINE__); |
|
2715 | 2715 | |
2716 | 2716 | return false; |
2717 | 2717 | } |
2718 | 2718 | $watermark_img = $this->ImageCreateFromStringReplacement(file_get_contents($this->config_nooffsitelink_watermark_src)); |
2719 | 2719 | $phpthumbFilters = new phpthumb_filters(); |
2720 | - $phpthumbFilters->phpThumbObject =& $this; |
|
2720 | + $phpthumbFilters->phpThumbObject = & $this; |
|
2721 | 2721 | $opacity = 50; |
2722 | 2722 | $margin = 5; |
2723 | 2723 | $phpthumbFilters->WatermarkOverlay($this->gdimg_output, $watermark_img, '*', $opacity, $margin); |
@@ -2730,7 +2730,7 @@ discard block |
||
2730 | 2730 | $topoffset = round(($this->thumbnail_height - (count($nohotlink_text_array) * imagefontheight($this->config_error_fontsize))) / 2); |
2731 | 2731 | |
2732 | 2732 | $rowcounter = 0; |
2733 | - $this->DebugMessage('AntiOffsiteLinking() writing ' . count($nohotlink_text_array) . ' lines of text "' . $this->config_nooffsitelink_text_message . '" (in #' . $this->config_error_textcolor . ') on top of image', __FILE__, __LINE__); |
|
2733 | + $this->DebugMessage('AntiOffsiteLinking() writing '.count($nohotlink_text_array).' lines of text "'.$this->config_nooffsitelink_text_message.'" (in #'.$this->config_error_textcolor.') on top of image', __FILE__, __LINE__); |
|
2734 | 2734 | foreach ($nohotlink_text_array as $textline) { |
2735 | 2735 | $leftoffset = max(0, round(($this->thumbnail_width - (strlen($textline) * imagefontwidth($this->config_error_fontsize))) / 2)); |
2736 | 2736 | imagestring($this->gdimg_output, $this->config_error_fontsize, $leftoffset, $topoffset + ($rowcounter++ * imagefontheight($this->config_error_fontsize)), $textline, $nohotlink_text_color); |
@@ -2756,7 +2756,7 @@ discard block |
||
2756 | 2756 | case 'png': |
2757 | 2757 | case 'ico': |
2758 | 2758 | // image has alpha transparency, but output as PNG or ICO which can handle it |
2759 | - $this->DebugMessage('skipping AlphaChannelFlatten() because ($this->thumbnailFormat == "' . $this->thumbnailFormat . '")', __FILE__, __LINE__); |
|
2759 | + $this->DebugMessage('skipping AlphaChannelFlatten() because ($this->thumbnailFormat == "'.$this->thumbnailFormat.'")', __FILE__, __LINE__); |
|
2760 | 2760 | |
2761 | 2761 | return false; |
2762 | 2762 | break; |
@@ -2768,7 +2768,7 @@ discard block |
||
2768 | 2768 | // no transparent color defined |
2769 | 2769 | |
2770 | 2770 | if (phpthumb_functions::gd_version() < 2.0) { |
2771 | - $this->DebugMessage('AlphaChannelFlatten() failed because GD version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__); |
|
2771 | + $this->DebugMessage('AlphaChannelFlatten() failed because GD version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__); |
|
2772 | 2772 | |
2773 | 2773 | return false; |
2774 | 2774 | } |
@@ -2812,24 +2812,24 @@ discard block |
||
2812 | 2812 | |
2813 | 2813 | return true; |
2814 | 2814 | } else { |
2815 | - $this->DebugMessage('AlphaChannelFlatten() failed imagecreate(' . imagesx($this->gdimg_output) . ', ' . imagesy($this->gdimg_output) . ')', __FILE__, __LINE__); |
|
2815 | + $this->DebugMessage('AlphaChannelFlatten() failed imagecreate('.imagesx($this->gdimg_output).', '.imagesy($this->gdimg_output).')', __FILE__, __LINE__); |
|
2816 | 2816 | |
2817 | 2817 | return false; |
2818 | 2818 | } |
2819 | 2819 | } else { |
2820 | 2820 | // a single transparent color already defined, leave as-is |
2821 | - $this->DebugMessage('skipping AlphaChannelFlatten() because ($this->thumbnailFormat == "' . $this->thumbnailFormat . '") and imagecolortransparent() returned "' . $CurrentImageColorTransparent . '"', __FILE__, __LINE__); |
|
2821 | + $this->DebugMessage('skipping AlphaChannelFlatten() because ($this->thumbnailFormat == "'.$this->thumbnailFormat.'") and imagecolortransparent() returned "'.$CurrentImageColorTransparent.'"', __FILE__, __LINE__); |
|
2822 | 2822 | |
2823 | 2823 | return true; |
2824 | 2824 | } |
2825 | 2825 | break; |
2826 | 2826 | } |
2827 | - $this->DebugMessage('continuing AlphaChannelFlatten() for output format "' . $this->thumbnailFormat . '"', __FILE__, __LINE__); |
|
2827 | + $this->DebugMessage('continuing AlphaChannelFlatten() for output format "'.$this->thumbnailFormat.'"', __FILE__, __LINE__); |
|
2828 | 2828 | // image has alpha transparency, and is being output in a format that doesn't support it -- flatten |
2829 | 2829 | if ($gdimg_flatten_temp = phpthumb_functions::ImageCreateFunction($this->thumbnail_width, $this->thumbnail_height)) { |
2830 | 2830 | $this->config_background_hexcolor = ($this->bg ?: $this->config_background_hexcolor); |
2831 | 2831 | if (!phpthumb_functions::IsHexColor($this->config_background_hexcolor)) { |
2832 | - return $this->ErrorImage('Invalid hex color string "' . $this->config_background_hexcolor . '" for parameter "bg"'); |
|
2832 | + return $this->ErrorImage('Invalid hex color string "'.$this->config_background_hexcolor.'" for parameter "bg"'); |
|
2833 | 2833 | } |
2834 | 2834 | $background_color = phpthumb_functions::ImageHexColorAllocate($this->gdimg_output, $this->config_background_hexcolor); |
2835 | 2835 | imagefilledrectangle($gdimg_flatten_temp, 0, 0, $this->thumbnail_width, $this->thumbnail_height, $background_color); |
@@ -2856,16 +2856,16 @@ discard block |
||
2856 | 2856 | public function ApplyFilters() |
2857 | 2857 | { |
2858 | 2858 | if ($this->fltr && is_array($this->fltr)) { |
2859 | - if (!require_once __DIR__ . '/phpthumb.filters.php') { |
|
2860 | - $this->DebugMessage('Error including "' . __DIR__ . '/phpthumb.filters.php" which is required for applying filters (' . implode(';', $this->fltr) . ')', __FILE__, __LINE__); |
|
2859 | + if (!require_once __DIR__.'/phpthumb.filters.php') { |
|
2860 | + $this->DebugMessage('Error including "'.__DIR__.'/phpthumb.filters.php" which is required for applying filters ('.implode(';', $this->fltr).')', __FILE__, __LINE__); |
|
2861 | 2861 | |
2862 | 2862 | return false; |
2863 | 2863 | } |
2864 | 2864 | $phpthumbFilters = new phpthumb_filters(); |
2865 | - $phpthumbFilters->phpThumbObject =& $this; |
|
2865 | + $phpthumbFilters->phpThumbObject = & $this; |
|
2866 | 2866 | foreach ($this->fltr as $filtercommand) { |
2867 | 2867 | @list($command, $parameter) = explode('|', $filtercommand, 2); |
2868 | - $this->DebugMessage('Attempting to process filter command "' . $command . '(' . $parameter . ')"', __FILE__, __LINE__); |
|
2868 | + $this->DebugMessage('Attempting to process filter command "'.$command.'('.$parameter.')"', __FILE__, __LINE__); |
|
2869 | 2869 | switch ($command) { |
2870 | 2870 | case 'brit': // Brightness |
2871 | 2871 | $phpthumbFilters->Brightness($this->gdimg_output, $parameter); |
@@ -2889,7 +2889,7 @@ discard block |
||
2889 | 2889 | |
2890 | 2890 | case 'clr': // Colorize |
2891 | 2891 | if (phpthumb_functions::gd_version() < 2) { |
2892 | - $this->DebugMessage('Skipping Colorize() because gd_version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__); |
|
2892 | + $this->DebugMessage('Skipping Colorize() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__); |
|
2893 | 2893 | break; |
2894 | 2894 | } |
2895 | 2895 | @list($amount, $color) = explode('|', $parameter, 2); |
@@ -2898,7 +2898,7 @@ discard block |
||
2898 | 2898 | |
2899 | 2899 | case 'sep': // Sepia |
2900 | 2900 | if (phpthumb_functions::gd_version() < 2) { |
2901 | - $this->DebugMessage('Skipping Sepia() because gd_version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__); |
|
2901 | + $this->DebugMessage('Skipping Sepia() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__); |
|
2902 | 2902 | break; |
2903 | 2903 | } |
2904 | 2904 | @list($amount, $color) = explode('|', $parameter, 2); |
@@ -2919,7 +2919,7 @@ discard block |
||
2919 | 2919 | |
2920 | 2920 | case 'rcd': // ReduceColorDepth |
2921 | 2921 | if (phpthumb_functions::gd_version() < 2) { |
2922 | - $this->DebugMessage('Skipping ReduceColorDepth() because gd_version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__); |
|
2922 | + $this->DebugMessage('Skipping ReduceColorDepth() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__); |
|
2923 | 2923 | break; |
2924 | 2924 | } |
2925 | 2925 | @list($colors, $dither) = explode('|', $parameter, 2); |
@@ -2960,7 +2960,7 @@ discard block |
||
2960 | 2960 | |
2961 | 2961 | case 'hist': // Histogram overlay |
2962 | 2962 | if (phpthumb_functions::gd_version() < 2) { |
2963 | - $this->DebugMessage('Skipping HistogramOverlay() because gd_version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__); |
|
2963 | + $this->DebugMessage('Skipping HistogramOverlay() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__); |
|
2964 | 2964 | break; |
2965 | 2965 | } |
2966 | 2966 | @list($bands, $colors, $width, $height, $alignment, $opacity, $margin_x, $margin_y) = explode('|', $parameter, 8); |
@@ -2982,7 +2982,7 @@ discard block |
||
2982 | 2982 | |
2983 | 2983 | case 'drop': // DropShadow |
2984 | 2984 | if (phpthumb_functions::gd_version() < 2) { |
2985 | - $this->DebugMessage('Skipping DropShadow() because gd_version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__); |
|
2985 | + $this->DebugMessage('Skipping DropShadow() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__); |
|
2986 | 2986 | |
2987 | 2987 | return false; |
2988 | 2988 | } |
@@ -2993,7 +2993,7 @@ discard block |
||
2993 | 2993 | |
2994 | 2994 | case 'mask': // Mask cropping |
2995 | 2995 | if (phpthumb_functions::gd_version() < 2) { |
2996 | - $this->DebugMessage('Skipping Mask() because gd_version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__); |
|
2996 | + $this->DebugMessage('Skipping Mask() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__); |
|
2997 | 2997 | |
2998 | 2998 | return false; |
2999 | 2999 | } |
@@ -3002,7 +3002,7 @@ discard block |
||
3002 | 3002 | if (@is_readable($mask_filename) && ($fp_mask = @fopen($mask_filename, 'rb'))) { |
3003 | 3003 | $MaskImageData = ''; |
3004 | 3004 | do { |
3005 | - $buffer = fread($fp_mask, 8192); |
|
3005 | + $buffer = fread($fp_mask, 8192); |
|
3006 | 3006 | $MaskImageData .= $buffer; |
3007 | 3007 | } while (strlen($buffer) > 0); |
3008 | 3008 | fclose($fp_mask); |
@@ -3016,16 +3016,16 @@ discard block |
||
3016 | 3016 | $phpthumbFilters->ApplyMask($gdimg_mask, $this->gdimg_output); |
3017 | 3017 | imagedestroy($gdimg_mask); |
3018 | 3018 | } else { |
3019 | - $this->DebugMessage('ImageCreateFromStringReplacement() failed for "' . $mask_filename . '"', __FILE__, __LINE__); |
|
3019 | + $this->DebugMessage('ImageCreateFromStringReplacement() failed for "'.$mask_filename.'"', __FILE__, __LINE__); |
|
3020 | 3020 | } |
3021 | 3021 | } else { |
3022 | - $this->DebugMessage('Cannot open mask file "' . $mask_filename . '"', __FILE__, __LINE__); |
|
3022 | + $this->DebugMessage('Cannot open mask file "'.$mask_filename.'"', __FILE__, __LINE__); |
|
3023 | 3023 | } |
3024 | 3024 | break; |
3025 | 3025 | |
3026 | 3026 | case 'elip': // Ellipse cropping |
3027 | 3027 | if (phpthumb_functions::gd_version() < 2) { |
3028 | - $this->DebugMessage('Skipping Ellipse() because gd_version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__); |
|
3028 | + $this->DebugMessage('Skipping Ellipse() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__); |
|
3029 | 3029 | |
3030 | 3030 | return false; |
3031 | 3031 | } |
@@ -3035,13 +3035,13 @@ discard block |
||
3035 | 3035 | |
3036 | 3036 | case 'ric': // RoundedImageCorners |
3037 | 3037 | if (phpthumb_functions::gd_version() < 2) { |
3038 | - $this->DebugMessage('Skipping RoundedImageCorners() because gd_version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__); |
|
3038 | + $this->DebugMessage('Skipping RoundedImageCorners() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__); |
|
3039 | 3039 | |
3040 | 3040 | return false; |
3041 | 3041 | } |
3042 | 3042 | @list($radius_x, $radius_y) = explode('|', $parameter, 2); |
3043 | 3043 | if (($radius_x < 1) || ($radius_y < 1)) { |
3044 | - $this->DebugMessage('Skipping RoundedImageCorners(' . $radius_x . ', ' . $radius_y . ') because x/y radius is less than 1', __FILE__, __LINE__); |
|
3044 | + $this->DebugMessage('Skipping RoundedImageCorners('.$radius_x.', '.$radius_y.') because x/y radius is less than 1', __FILE__, __LINE__); |
|
3045 | 3045 | break; |
3046 | 3046 | } |
3047 | 3047 | $this->is_alpha = true; |
@@ -3074,7 +3074,7 @@ discard block |
||
3074 | 3074 | if (@is_readable($filename) && ($fp_watermark = @fopen($filename, 'rb'))) { |
3075 | 3075 | $WatermarkImageData = ''; |
3076 | 3076 | do { |
3077 | - $buffer = fread($fp_watermark, 8192); |
|
3077 | + $buffer = fread($fp_watermark, 8192); |
|
3078 | 3078 | $WatermarkImageData .= $buffer; |
3079 | 3079 | } while (strlen($buffer) > 0); |
3080 | 3080 | fclose($fp_watermark); |
@@ -3099,11 +3099,11 @@ discard block |
||
3099 | 3099 | $phpthumbFilters->WatermarkOverlay($img_watermark_resized, $img_source_resized, 'C', $opacity, $margin); |
3100 | 3100 | imagecopy($this->gdimg_output, $img_watermark_resized, 0, 0, 0, 0, imagesx($this->gdimg_output), imagesy($this->gdimg_output)); |
3101 | 3101 | } else { |
3102 | - $this->DebugMessage('phpthumb_functions::ImageCreateFunction(' . $resized_x . ', ' . $resized_y . ')', __FILE__, __LINE__); |
|
3102 | + $this->DebugMessage('phpthumb_functions::ImageCreateFunction('.$resized_x.', '.$resized_y.')', __FILE__, __LINE__); |
|
3103 | 3103 | } |
3104 | 3104 | imagedestroy($img_watermark_resized); |
3105 | 3105 | } else { |
3106 | - $this->DebugMessage('phpthumb_functions::ImageCreateFunction(' . imagesx($this->gdimg_output) . ', ' . imagesy($this->gdimg_output) . ')', __FILE__, __LINE__); |
|
3106 | + $this->DebugMessage('phpthumb_functions::ImageCreateFunction('.imagesx($this->gdimg_output).', '.imagesy($this->gdimg_output).')', __FILE__, __LINE__); |
|
3107 | 3107 | } |
3108 | 3108 | } else { // overlay |
3109 | 3109 | |
@@ -3114,15 +3114,15 @@ discard block |
||
3114 | 3114 | $phpthumbFilters->WatermarkOverlay($this->gdimg_output, $img_watermark_resized, 'C', $opacity, $margin); |
3115 | 3115 | imagedestroy($img_watermark_resized); |
3116 | 3116 | } else { |
3117 | - $this->DebugMessage('phpthumb_functions::ImageCreateFunction(' . $resized_x . ', ' . $resized_y . ')', __FILE__, __LINE__); |
|
3117 | + $this->DebugMessage('phpthumb_functions::ImageCreateFunction('.$resized_x.', '.$resized_y.')', __FILE__, __LINE__); |
|
3118 | 3118 | } |
3119 | 3119 | } |
3120 | 3120 | imagedestroy($img_watermark); |
3121 | 3121 | } else { |
3122 | - $this->DebugMessage('ImageCreateFromStringReplacement() failed for "' . $filename . '"', __FILE__, __LINE__); |
|
3122 | + $this->DebugMessage('ImageCreateFromStringReplacement() failed for "'.$filename.'"', __FILE__, __LINE__); |
|
3123 | 3123 | } |
3124 | 3124 | } else { |
3125 | - $this->DebugMessage('Cannot open overlay file "' . $filename . '"', __FILE__, __LINE__); |
|
3125 | + $this->DebugMessage('Cannot open overlay file "'.$filename.'"', __FILE__, __LINE__); |
|
3126 | 3126 | } |
3127 | 3127 | break; |
3128 | 3128 | |
@@ -3154,7 +3154,7 @@ discard block |
||
3154 | 3154 | $watermark_max_width = ($margin['x'] ?: imagesx($img_watermark)); |
3155 | 3155 | $watermark_max_height = ($margin['y'] ?: imagesy($img_watermark)); |
3156 | 3156 | $scale = phpthumb_functions::ScaleToFitInBox(imagesx($img_watermark), imagesy($img_watermark), $watermark_max_width, $watermark_max_height, true, true); |
3157 | - $this->DebugMessage('Scaling watermark by a factor of ' . number_format($scale, 4), __FILE__, __LINE__); |
|
3157 | + $this->DebugMessage('Scaling watermark by a factor of '.number_format($scale, 4), __FILE__, __LINE__); |
|
3158 | 3158 | if (($scale > 1) || ($scale < 1)) { |
3159 | 3159 | if ($img_watermark2 = phpthumb_functions::ImageCreateFunction($scale * imagesx($img_watermark), $scale * imagesy($img_watermark))) { |
3160 | 3160 | imagealphablending($img_watermark2, false); |
@@ -3162,12 +3162,12 @@ discard block |
||
3162 | 3162 | $this->ImageResizeFunction($img_watermark2, $img_watermark, 0, 0, 0, 0, imagesx($img_watermark2), imagesy($img_watermark2), imagesx($img_watermark), imagesy($img_watermark)); |
3163 | 3163 | $img_watermark = $img_watermark2; |
3164 | 3164 | } else { |
3165 | - $this->DebugMessage('ImageCreateFunction(' . ($scale * imagesx($img_watermark)) . ', ' . ($scale * imagesx($img_watermark)) . ') failed', __FILE__, __LINE__); |
|
3165 | + $this->DebugMessage('ImageCreateFunction('.($scale * imagesx($img_watermark)).', '.($scale * imagesx($img_watermark)).') failed', __FILE__, __LINE__); |
|
3166 | 3166 | } |
3167 | 3167 | } |
3168 | 3168 | $watermark_dest_x = round($matches[1] - (imagesx($img_watermark) / 2)); |
3169 | 3169 | $watermark_dest_y = round($matches[2] - (imagesy($img_watermark) / 2)); |
3170 | - $alignment = $watermark_dest_x . 'x' . $watermark_dest_y; |
|
3170 | + $alignment = $watermark_dest_x.'x'.$watermark_dest_y; |
|
3171 | 3171 | } |
3172 | 3172 | $phpthumbFilters->WatermarkOverlay($this->gdimg_output, $img_watermark, $alignment, $opacity, $margin['x'], $margin['y']); |
3173 | 3173 | imagedestroy($img_watermark); |
@@ -3175,10 +3175,10 @@ discard block |
||
3175 | 3175 | imagedestroy($img_watermark2); |
3176 | 3176 | } |
3177 | 3177 | } else { |
3178 | - $this->DebugMessage('ImageCreateFromFilename() failed for "' . $filename . '"', __FILE__, __LINE__); |
|
3178 | + $this->DebugMessage('ImageCreateFromFilename() failed for "'.$filename.'"', __FILE__, __LINE__); |
|
3179 | 3179 | } |
3180 | 3180 | } else { |
3181 | - $this->DebugMessage('!is_readable(' . $filename . ')', __FILE__, __LINE__); |
|
3181 | + $this->DebugMessage('!is_readable('.$filename.')', __FILE__, __LINE__); |
|
3182 | 3182 | } |
3183 | 3183 | break; |
3184 | 3184 | |
@@ -3197,7 +3197,7 @@ discard block |
||
3197 | 3197 | $fillextend = ($fillextend ?: ''); |
3198 | 3198 | |
3199 | 3199 | if (basename($ttffont) == $ttffont) { |
3200 | - $ttffont = $this->realPathSafe($this->config_ttf_directory . DIRECTORY_SEPARATOR . $ttffont); |
|
3200 | + $ttffont = $this->realPathSafe($this->config_ttf_directory.DIRECTORY_SEPARATOR.$ttffont); |
|
3201 | 3201 | } else { |
3202 | 3202 | $ttffont = $this->ResolveFilenameToAbsolute($ttffont); |
3203 | 3203 | } |
@@ -3210,7 +3210,7 @@ discard block |
||
3210 | 3210 | if (phpthumb_functions::gd_version() >= 2) { |
3211 | 3211 | $phpthumbFilters->Blur($this->gdimg_output, $radius); |
3212 | 3212 | } else { |
3213 | - $this->DebugMessage('Skipping Blur() because gd_version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__); |
|
3213 | + $this->DebugMessage('Skipping Blur() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__); |
|
3214 | 3214 | } |
3215 | 3215 | break; |
3216 | 3216 | |
@@ -3237,12 +3237,12 @@ discard block |
||
3237 | 3237 | $threshold = (strlen($threshold) ? $threshold : 3); |
3238 | 3238 | if (phpthumb_functions::gd_version() >= 2.0) { |
3239 | 3239 | ob_start(); |
3240 | - if (!@require_once __DIR__ . '/phpthumb.unsharp.php') { |
|
3240 | + if (!@require_once __DIR__.'/phpthumb.unsharp.php') { |
|
3241 | 3241 | $include_error = ob_get_contents(); |
3242 | 3242 | if ($include_error) { |
3243 | - $this->DebugMessage('include_once("' . __DIR__ . '/phpthumb.unsharp.php") generated message: "' . $include_error . '"', __FILE__, __LINE__); |
|
3243 | + $this->DebugMessage('include_once("'.__DIR__.'/phpthumb.unsharp.php") generated message: "'.$include_error.'"', __FILE__, __LINE__); |
|
3244 | 3244 | } |
3245 | - $this->DebugMessage('Error including "' . __DIR__ . '/phpthumb.unsharp.php" which is required for unsharp masking', __FILE__, __LINE__); |
|
3245 | + $this->DebugMessage('Error including "'.__DIR__.'/phpthumb.unsharp.php" which is required for unsharp masking', __FILE__, __LINE__); |
|
3246 | 3246 | ob_end_clean(); |
3247 | 3247 | |
3248 | 3248 | return false; |
@@ -3250,7 +3250,7 @@ discard block |
||
3250 | 3250 | ob_end_clean(); |
3251 | 3251 | phpUnsharpMask::applyUnsharpMask($this->gdimg_output, $amount, $radius, $threshold); |
3252 | 3252 | } else { |
3253 | - $this->DebugMessage('Skipping unsharp mask because gd_version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__); |
|
3253 | + $this->DebugMessage('Skipping unsharp mask because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__); |
|
3254 | 3254 | |
3255 | 3255 | return false; |
3256 | 3256 | } |
@@ -3270,7 +3270,7 @@ discard block |
||
3270 | 3270 | $scale_x = phpthumb_functions::ScaleToFitInBox(imagesx($this->gdimg_output), imagesy($this->gdimg_output), $newwidth, $newheight, true, true); |
3271 | 3271 | $scale_y = $scale_x; |
3272 | 3272 | } |
3273 | - $this->DebugMessage('Scaling watermark (' . ($stretch ? 'with' : 'without') . ' stretch) by a factor of "' . number_format($scale_x, 4) . ' x ' . number_format($scale_y, 4) . '"', __FILE__, __LINE__); |
|
3273 | + $this->DebugMessage('Scaling watermark ('.($stretch ? 'with' : 'without').' stretch) by a factor of "'.number_format($scale_x, 4).' x '.number_format($scale_y, 4).'"', __FILE__, __LINE__); |
|
3274 | 3274 | if (($scale_x > 1) || ($scale_x < 1) || ($scale_y > 1) || ($scale_y < 1)) { |
3275 | 3275 | if ($img_temp = phpthumb_functions::ImageCreateFunction(imagesx($this->gdimg_output), imagesy($this->gdimg_output))) { |
3276 | 3276 | imagecopy($img_temp, $this->gdimg_output, 0, 0, 0, 0, imagesx($this->gdimg_output), imagesy($this->gdimg_output)); |
@@ -3279,11 +3279,11 @@ discard block |
||
3279 | 3279 | imagesavealpha($this->gdimg_output, true); |
3280 | 3280 | $this->ImageResizeFunction($this->gdimg_output, $img_temp, 0, 0, 0, 0, imagesx($this->gdimg_output), imagesy($this->gdimg_output), imagesx($img_temp), imagesy($img_temp)); |
3281 | 3281 | } else { |
3282 | - $this->DebugMessage('ImageCreateFunction(' . ($scale_x * imagesx($img_temp)) . ', ' . ($scale_y * imagesy($img_temp)) . ') failed', __FILE__, __LINE__); |
|
3282 | + $this->DebugMessage('ImageCreateFunction('.($scale_x * imagesx($img_temp)).', '.($scale_y * imagesy($img_temp)).') failed', __FILE__, __LINE__); |
|
3283 | 3283 | } |
3284 | 3284 | imagedestroy($img_temp); |
3285 | 3285 | } else { |
3286 | - $this->DebugMessage('ImageCreateFunction(' . imagesx($this->gdimg_output) . ', ' . imagesy($this->gdimg_output) . ') failed', __FILE__, __LINE__); |
|
3286 | + $this->DebugMessage('ImageCreateFunction('.imagesx($this->gdimg_output).', '.imagesy($this->gdimg_output).') failed', __FILE__, __LINE__); |
|
3287 | 3287 | } |
3288 | 3288 | } |
3289 | 3289 | break; |
@@ -3296,7 +3296,7 @@ discard block |
||
3296 | 3296 | case 'stc': // Source Transparent Color |
3297 | 3297 | @list($hexcolor, $min_limit, $max_limit) = explode('|', $parameter, 3); |
3298 | 3298 | if (!phpthumb_functions::IsHexColor($hexcolor)) { |
3299 | - $this->DebugMessage('Skipping SourceTransparentColor hex color is invalid (' . $hexcolor . ')', __FILE__, __LINE__); |
|
3299 | + $this->DebugMessage('Skipping SourceTransparentColor hex color is invalid ('.$hexcolor.')', __FILE__, __LINE__); |
|
3300 | 3300 | |
3301 | 3301 | return false; |
3302 | 3302 | } |
@@ -3307,11 +3307,11 @@ discard block |
||
3307 | 3307 | $phpthumbFilters->ApplyMask($gdimg_mask, $this->gdimg_output); |
3308 | 3308 | imagedestroy($gdimg_mask); |
3309 | 3309 | } else { |
3310 | - $this->DebugMessage('SourceTransparentColorMask() failed for "' . $hexcolor . ',' . $min_limit . ',' . $max_limit . '"', __FILE__, __LINE__); |
|
3310 | + $this->DebugMessage('SourceTransparentColorMask() failed for "'.$hexcolor.','.$min_limit.','.$max_limit.'"', __FILE__, __LINE__); |
|
3311 | 3311 | } |
3312 | 3312 | break; |
3313 | 3313 | } |
3314 | - $this->DebugMessage('Finished processing filter command "' . $command . '(' . $parameter . ')"', __FILE__, __LINE__); |
|
3314 | + $this->DebugMessage('Finished processing filter command "'.$command.'('.$parameter.')"', __FILE__, __LINE__); |
|
3315 | 3315 | } |
3316 | 3316 | } |
3317 | 3317 | |
@@ -3324,7 +3324,7 @@ discard block |
||
3324 | 3324 | public function MaxFileSize() |
3325 | 3325 | { |
3326 | 3326 | if (phpthumb_functions::gd_version() < 2) { |
3327 | - $this->DebugMessage('Skipping MaxFileSize() because gd_version is "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__); |
|
3327 | + $this->DebugMessage('Skipping MaxFileSize() because gd_version is "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__); |
|
3328 | 3328 | |
3329 | 3329 | return false; |
3330 | 3330 | } |
@@ -3332,7 +3332,7 @@ discard block |
||
3332 | 3332 | switch ($this->thumbnailFormat) { |
3333 | 3333 | case 'png': |
3334 | 3334 | case 'gif': |
3335 | - $imgRenderFunction = 'image' . $this->thumbnailFormat; |
|
3335 | + $imgRenderFunction = 'image'.$this->thumbnailFormat; |
|
3336 | 3336 | |
3337 | 3337 | ob_start(); |
3338 | 3338 | $imgRenderFunction($this->gdimg_output); |
@@ -3395,7 +3395,7 @@ discard block |
||
3395 | 3395 | */ |
3396 | 3396 | public function CalculateThumbnailDimensions() |
3397 | 3397 | { |
3398 | - $this->DebugMessage('CalculateThumbnailDimensions() starting with [W,H,sx,sy,sw,sh] initially set to [' . $this->source_width . ',' . $this->source_height . ',' . $this->sx . ',' . $this->sy . ',' . $this->sw . ',' . $this->sh . ']', __FILE__, __LINE__); |
|
3398 | + $this->DebugMessage('CalculateThumbnailDimensions() starting with [W,H,sx,sy,sw,sh] initially set to ['.$this->source_width.','.$this->source_height.','.$this->sx.','.$this->sy.','.$this->sw.','.$this->sh.']', __FILE__, __LINE__); |
|
3399 | 3399 | //echo $this->source_width.'x'.$this->source_height.'<hr>'; |
3400 | 3400 | $this->thumbnailCropX = ($this->sx ? (($this->sx >= 2) ? $this->sx : round($this->sx * $this->source_width)) : 0); |
3401 | 3401 | //echo $this->thumbnailCropX.'<br>'; |
@@ -3410,7 +3410,7 @@ discard block |
||
3410 | 3410 | $this->thumbnailCropW = max(1, min($this->thumbnailCropW, $this->source_width - $this->thumbnailCropX)); |
3411 | 3411 | $this->thumbnailCropH = max(1, min($this->thumbnailCropH, $this->source_height - $this->thumbnailCropY)); |
3412 | 3412 | |
3413 | - $this->DebugMessage('CalculateThumbnailDimensions() starting with [x,y,w,h] initially set to [' . $this->thumbnailCropX . ',' . $this->thumbnailCropY . ',' . $this->thumbnailCropW . ',' . $this->thumbnailCropH . ']', __FILE__, __LINE__); |
|
3413 | + $this->DebugMessage('CalculateThumbnailDimensions() starting with [x,y,w,h] initially set to ['.$this->thumbnailCropX.','.$this->thumbnailCropY.','.$this->thumbnailCropW.','.$this->thumbnailCropH.']', __FILE__, __LINE__); |
|
3414 | 3414 | |
3415 | 3415 | if ($this->zc && $this->w && $this->h) { |
3416 | 3416 | // Zoom Crop |
@@ -3504,13 +3504,13 @@ discard block |
||
3504 | 3504 | if ($this->bg || (@$current_transparent_color >= 0)) { |
3505 | 3505 | $this->config_background_hexcolor = ($this->bg ?: $this->config_background_hexcolor); |
3506 | 3506 | if (!phpthumb_functions::IsHexColor($this->config_background_hexcolor)) { |
3507 | - return $this->ErrorImage('Invalid hex color string "' . $this->config_background_hexcolor . '" for parameter "bg"'); |
|
3507 | + return $this->ErrorImage('Invalid hex color string "'.$this->config_background_hexcolor.'" for parameter "bg"'); |
|
3508 | 3508 | } |
3509 | 3509 | $background_color = phpthumb_functions::ImageHexColorAllocate($this->gdimg_output, $this->config_background_hexcolor); |
3510 | 3510 | imagefilledrectangle($this->gdimg_output, 0, 0, $this->thumbnail_width, $this->thumbnail_height, $background_color); |
3511 | 3511 | } |
3512 | 3512 | } |
3513 | - $this->DebugMessage('CreateGDoutput() returning canvas "' . $this->thumbnail_width . 'x' . $this->thumbnail_height . '"', __FILE__, __LINE__); |
|
3513 | + $this->DebugMessage('CreateGDoutput() returning canvas "'.$this->thumbnail_width.'x'.$this->thumbnail_height.'"', __FILE__, __LINE__); |
|
3514 | 3514 | |
3515 | 3515 | return true; |
3516 | 3516 | } |
@@ -3520,7 +3520,7 @@ discard block |
||
3520 | 3520 | */ |
3521 | 3521 | public function SetOrientationDependantWidthHeight() |
3522 | 3522 | { |
3523 | - $this->DebugMessage('SetOrientationDependantWidthHeight() starting with "' . $this->source_width . '"x"' . $this->source_height . '"', __FILE__, __LINE__); |
|
3523 | + $this->DebugMessage('SetOrientationDependantWidthHeight() starting with "'.$this->source_width.'"x"'.$this->source_height.'"', __FILE__, __LINE__); |
|
3524 | 3524 | if ($this->source_height > $this->source_width) { |
3525 | 3525 | // portrait |
3526 | 3526 | $this->w = phpthumb_functions::OneOfThese($this->wp, $this->w, $this->ws, $this->wl); |
@@ -3536,7 +3536,7 @@ discard block |
||
3536 | 3536 | } |
3537 | 3537 | //$this->w = round($this->w ? $this->w : (($this->h && $this->source_height) ? $this->h * $this->source_width / $this->source_height : $this->w)); |
3538 | 3538 | //$this->h = round($this->h ? $this->h : (($this->w && $this->source_width) ? $this->w * $this->source_height / $this->source_width : $this->h)); |
3539 | - $this->DebugMessage('SetOrientationDependantWidthHeight() setting w="' . (int)$this->w . '", h="' . (int)$this->h . '"', __FILE__, __LINE__); |
|
3539 | + $this->DebugMessage('SetOrientationDependantWidthHeight() setting w="'.(int)$this->w.'", h="'.(int)$this->h.'"', __FILE__, __LINE__); |
|
3540 | 3540 | |
3541 | 3541 | return true; |
3542 | 3542 | } |
@@ -3556,7 +3556,7 @@ discard block |
||
3556 | 3556 | $this->getimagesizeinfo = @getimagesize($this->sourceFilename); |
3557 | 3557 | $this->source_width = $this->getimagesizeinfo[0]; |
3558 | 3558 | $this->source_height = $this->getimagesizeinfo[1]; |
3559 | - $this->DebugMessage('getimagesize(' . $this->sourceFilename . ') says image is ' . $this->source_width . 'x' . $this->source_height, __FILE__, __LINE__); |
|
3559 | + $this->DebugMessage('getimagesize('.$this->sourceFilename.') says image is '.$this->source_width.'x'.$this->source_height, __FILE__, __LINE__); |
|
3560 | 3560 | } else { |
3561 | 3561 | $this->DebugMessage('skipping getimagesize() because $this->sourceFilename is empty', __FILE__, __LINE__); |
3562 | 3562 | } |
@@ -3571,11 +3571,11 @@ discard block |
||
3571 | 3571 | $this->SetOrientationDependantWidthHeight(); |
3572 | 3572 | } elseif ($this->rawImageData && !$this->sourceFilename) { |
3573 | 3573 | if ($this->SourceImageIsTooLarge($this->source_width, $this->source_height)) { |
3574 | - $this->DebugMessage('NOT bypassing EXIF and getimagesize sections because source image is too large for GD (' . $this->source_width . 'x' . $this->source_width . '=' . ($this->source_width * $this->source_height * 5) . 'MB)', __FILE__, __LINE__); |
|
3574 | + $this->DebugMessage('NOT bypassing EXIF and getimagesize sections because source image is too large for GD ('.$this->source_width.'x'.$this->source_width.'='.($this->source_width * $this->source_height * 5).'MB)', __FILE__, __LINE__); |
|
3575 | 3575 | } else { |
3576 | - $this->DebugMessage('bypassing EXIF and getimagesize sections because $this->rawImageData is set, and $this->sourceFilename is not set, and source image is not too large for GD (' . $this->source_width . 'x' . $this->source_width . '=' . ($this->source_width |
|
3576 | + $this->DebugMessage('bypassing EXIF and getimagesize sections because $this->rawImageData is set, and $this->sourceFilename is not set, and source image is not too large for GD ('.$this->source_width.'x'.$this->source_width.'='.($this->source_width |
|
3577 | 3577 | * $this->source_height |
3578 | - * 5) . 'MB)', __FILE__, __LINE__); |
|
3578 | + * 5).'MB)', __FILE__, __LINE__); |
|
3579 | 3579 | } |
3580 | 3580 | } |
3581 | 3581 | |
@@ -3587,7 +3587,7 @@ discard block |
||
3587 | 3587 | // great |
3588 | 3588 | $this->getimagesizeinfo['filesize'] = @filesize($this->sourceFilename); |
3589 | 3589 | } elseif (!$this->rawImageData) { |
3590 | - $this->DebugMessage('getimagesize("' . $this->sourceFilename . '") failed', __FILE__, __LINE__); |
|
3590 | + $this->DebugMessage('getimagesize("'.$this->sourceFilename.'") failed', __FILE__, __LINE__); |
|
3591 | 3591 | } |
3592 | 3592 | |
3593 | 3593 | if ($this->config_prefer_imagemagick) { |
@@ -3636,7 +3636,7 @@ discard block |
||
3636 | 3636 | $this->exif_thumbnail_type = 2; // (2 == JPEG) before PHP v4.3.0 only JPEG format EXIF thumbnails are returned |
3637 | 3637 | unset($gdimg_exif_temp); |
3638 | 3638 | } else { |
3639 | - return $this->ErrorImage('Failed - $this->ImageCreateFromStringReplacement($this->exif_thumbnail_data) in ' . __FILE__ . ' on line ' . __LINE__); |
|
3639 | + return $this->ErrorImage('Failed - $this->ImageCreateFromStringReplacement($this->exif_thumbnail_data) in '.__FILE__.' on line '.__LINE__); |
|
3640 | 3640 | } |
3641 | 3641 | } |
3642 | 3642 | } |
@@ -3644,7 +3644,7 @@ discard block |
||
3644 | 3644 | $this->DebugMessage('exif_thumbnail() does not exist, cannot extract EXIF thumbnail', __FILE__, __LINE__); |
3645 | 3645 | } |
3646 | 3646 | |
3647 | - $this->DebugMessage('EXIF thumbnail extraction: (size=' . strlen($this->exif_thumbnail_data) . '; type="' . $this->exif_thumbnail_type . '"; ' . (int)$this->exif_thumbnail_width . 'x' . (int)$this->exif_thumbnail_height . ')', __FILE__, __LINE__); |
|
3647 | + $this->DebugMessage('EXIF thumbnail extraction: (size='.strlen($this->exif_thumbnail_data).'; type="'.$this->exif_thumbnail_type.'"; '.(int)$this->exif_thumbnail_width.'x'.(int)$this->exif_thumbnail_height.')', __FILE__, __LINE__); |
|
3648 | 3648 | |
3649 | 3649 | // see if EXIF thumbnail can be used directly with no processing |
3650 | 3650 | if ($this->config_use_exif_thumbnail_for_speed && $this->exif_thumbnail_data) { |
@@ -3653,15 +3653,15 @@ discard block |
||
3653 | 3653 | $source_ar = $this->source_width / $this->source_height; |
3654 | 3654 | $exif_ar = $this->exif_thumbnail_width / $this->exif_thumbnail_height; |
3655 | 3655 | if (number_format($source_ar, 2) != number_format($exif_ar, 2)) { |
3656 | - $this->DebugMessage('not using EXIF thumbnail because $source_ar != $exif_ar (' . $source_ar . ' != ' . $exif_ar . ')', __FILE__, __LINE__); |
|
3656 | + $this->DebugMessage('not using EXIF thumbnail because $source_ar != $exif_ar ('.$source_ar.' != '.$exif_ar.')', __FILE__, __LINE__); |
|
3657 | 3657 | break; |
3658 | 3658 | } |
3659 | 3659 | if ($this->w && ($this->w != $this->exif_thumbnail_width)) { |
3660 | - $this->DebugMessage('not using EXIF thumbnail because $this->w != $this->exif_thumbnail_width (' . $this->w . ' != ' . $this->exif_thumbnail_width . ')', __FILE__, __LINE__); |
|
3660 | + $this->DebugMessage('not using EXIF thumbnail because $this->w != $this->exif_thumbnail_width ('.$this->w.' != '.$this->exif_thumbnail_width.')', __FILE__, __LINE__); |
|
3661 | 3661 | break; |
3662 | 3662 | } |
3663 | 3663 | if ($this->h && ($this->h != $this->exif_thumbnail_height)) { |
3664 | - $this->DebugMessage('not using EXIF thumbnail because $this->h != $this->exif_thumbnail_height (' . $this->h . ' != ' . $this->exif_thumbnail_height . ')', __FILE__, __LINE__); |
|
3664 | + $this->DebugMessage('not using EXIF thumbnail because $this->h != $this->exif_thumbnail_height ('.$this->h.' != '.$this->exif_thumbnail_height.')', __FILE__, __LINE__); |
|
3665 | 3665 | break; |
3666 | 3666 | } |
3667 | 3667 | $CannotBeSetParameters = ['sx', 'sy', 'sh', 'sw', 'far', 'bg', 'bc', 'fltr', 'phpThumbDebug']; |
@@ -3688,7 +3688,7 @@ discard block |
||
3688 | 3688 | // If ImageMagick is installed, use it to generate the thumbnail. |
3689 | 3689 | // Else, if an EXIF thumbnail is available, use that as the source image. |
3690 | 3690 | // Otherwise, no choice but to fail with an error message |
3691 | - $this->DebugMessage('image is ' . $this->source_width . 'x' . $this->source_height . ' and therefore contains more pixels (' . ($this->source_width * $this->source_height) . ') than $this->config_max_source_pixels setting (' . $this->config_max_source_pixels . ')', __FILE__, __LINE__); |
|
3691 | + $this->DebugMessage('image is '.$this->source_width.'x'.$this->source_height.' and therefore contains more pixels ('.($this->source_width * $this->source_height).') than $this->config_max_source_pixels setting ('.$this->config_max_source_pixels.')', __FILE__, __LINE__); |
|
3692 | 3692 | if (!$this->config_prefer_imagemagick && $this->ImageMagickThumbnailToGD()) { |
3693 | 3693 | // excellent, we have a thumbnailed source image |
3694 | 3694 | return true; |
@@ -3728,10 +3728,10 @@ discard block |
||
3728 | 3728 | // substitute source filename into * in $this->config_cache_default_only_suffix |
3729 | 3729 | // (eg: '*_thumb' becomes 'picture_thumb.jpg') |
3730 | 3730 | if (false === strpos($this->config_cache_default_only_suffix, '*')) { |
3731 | - $this->DebugMessage('aborting simplified caching filename because no * in "' . $this->config_cache_default_only_suffix . '"', __FILE__, __LINE__); |
|
3731 | + $this->DebugMessage('aborting simplified caching filename because no * in "'.$this->config_cache_default_only_suffix.'"', __FILE__, __LINE__); |
|
3732 | 3732 | } else { |
3733 | 3733 | preg_match('#(.+)(\\.[a-z0-9]+)?$#i', basename($this->sourceFilename), $matches); |
3734 | - $this->cache_filename = $this->config_cache_directory . DIRECTORY_SEPARATOR . rawurlencode(str_replace('*', @$matches[1], $this->config_cache_default_only_suffix)) . '.' . strtolower($this->thumbnailFormat); |
|
3734 | + $this->cache_filename = $this->config_cache_directory.DIRECTORY_SEPARATOR.rawurlencode(str_replace('*', @$matches[1], $this->config_cache_default_only_suffix)).'.'.strtolower($this->thumbnailFormat); |
|
3735 | 3735 | |
3736 | 3736 | return true; |
3737 | 3737 | } |
@@ -3740,24 +3740,24 @@ discard block |
||
3740 | 3740 | $this->cache_filename = ''; |
3741 | 3741 | if ($this->new) { |
3742 | 3742 | $broad_directory_name = strtolower(md5($this->new)); |
3743 | - $this->cache_filename .= '_new' . $broad_directory_name; |
|
3743 | + $this->cache_filename .= '_new'.$broad_directory_name; |
|
3744 | 3744 | } elseif ($this->md5s) { |
3745 | 3745 | // source image MD5 hash provided |
3746 | - $this->DebugMessage('SetCacheFilename() _raw set from $this->md5s = "' . $this->md5s . '"', __FILE__, __LINE__); |
|
3746 | + $this->DebugMessage('SetCacheFilename() _raw set from $this->md5s = "'.$this->md5s.'"', __FILE__, __LINE__); |
|
3747 | 3747 | $broad_directory_name = $this->md5s; |
3748 | - $this->cache_filename .= '_raw' . $this->md5s; |
|
3748 | + $this->cache_filename .= '_raw'.$this->md5s; |
|
3749 | 3749 | } elseif (!$this->src && $this->rawImageData) { |
3750 | - $this->DebugMessage('SetCacheFilename() _raw set from md5($this->rawImageData) = "' . md5($this->rawImageData) . '"', __FILE__, __LINE__); |
|
3750 | + $this->DebugMessage('SetCacheFilename() _raw set from md5($this->rawImageData) = "'.md5($this->rawImageData).'"', __FILE__, __LINE__); |
|
3751 | 3751 | $broad_directory_name = strtolower(md5($this->rawImageData)); |
3752 | - $this->cache_filename .= '_raw' . $broad_directory_name; |
|
3752 | + $this->cache_filename .= '_raw'.$broad_directory_name; |
|
3753 | 3753 | } else { |
3754 | - $this->DebugMessage('SetCacheFilename() _src set from md5($this->sourceFilename) "' . $this->sourceFilename . '" = "' . md5($this->sourceFilename) . '"', __FILE__, __LINE__); |
|
3754 | + $this->DebugMessage('SetCacheFilename() _src set from md5($this->sourceFilename) "'.$this->sourceFilename.'" = "'.md5($this->sourceFilename).'"', __FILE__, __LINE__); |
|
3755 | 3755 | $broad_directory_name = strtolower(md5($this->sourceFilename)); |
3756 | - $this->cache_filename .= '_src' . $broad_directory_name; |
|
3756 | + $this->cache_filename .= '_src'.$broad_directory_name; |
|
3757 | 3757 | } |
3758 | 3758 | if (!empty($_SERVER['HTTP_REFERER']) && $this->config_nooffsitelink_enabled) { |
3759 | 3759 | $parsed_url1 = @phpthumb_functions::ParseURLbetter(@$_SERVER['HTTP_REFERER']); |
3760 | - $parsed_url2 = @phpthumb_functions::ParseURLbetter('http://' . @$_SERVER['HTTP_HOST']); |
|
3760 | + $parsed_url2 = @phpthumb_functions::ParseURLbetter('http://'.@$_SERVER['HTTP_HOST']); |
|
3761 | 3761 | if (@$parsed_url1['host'] && @$parsed_url2['host'] && ($parsed_url1['host'] != $parsed_url2['host'])) { |
3762 | 3762 | // include "_offsite" only if nooffsitelink_enabled and if referrer doesn't match the domain of the current server |
3763 | 3763 | $this->cache_filename .= '_offsite'; |
@@ -3766,12 +3766,12 @@ discard block |
||
3766 | 3766 | |
3767 | 3767 | $ParametersString = ''; |
3768 | 3768 | if ($this->fltr && is_array($this->fltr)) { |
3769 | - $ParametersString .= '_fltr' . implode('_fltr', $this->fltr); |
|
3769 | + $ParametersString .= '_fltr'.implode('_fltr', $this->fltr); |
|
3770 | 3770 | } |
3771 | 3771 | $FilenameParameters1 = ['ar', 'bg', 'bc', 'far', 'sx', 'sy', 'sw', 'sh', 'zc']; |
3772 | 3772 | foreach ($FilenameParameters1 as $key) { |
3773 | 3773 | if ($this->$key) { |
3774 | - $ParametersString .= '_' . $key . $this->$key; |
|
3774 | + $ParametersString .= '_'.$key.$this->$key; |
|
3775 | 3775 | } |
3776 | 3776 | } |
3777 | 3777 | $FilenameParameters2 = [ |
@@ -3792,33 +3792,33 @@ discard block |
||
3792 | 3792 | ]; |
3793 | 3793 | foreach ($FilenameParameters2 as $key) { |
3794 | 3794 | if ($this->$key) { |
3795 | - $ParametersString .= '_' . $key . (int)$this->$key; |
|
3795 | + $ParametersString .= '_'.$key.(int)$this->$key; |
|
3796 | 3796 | } |
3797 | 3797 | } |
3798 | 3798 | if ('jpeg' === $this->thumbnailFormat) { |
3799 | 3799 | // only JPEG output has variable quality option |
3800 | - $ParametersString .= '_q' . (int)$this->thumbnailQuality; |
|
3800 | + $ParametersString .= '_q'.(int)$this->thumbnailQuality; |
|
3801 | 3801 | } |
3802 | - $this->DebugMessage('SetCacheFilename() _par set from md5(' . $ParametersString . ')', __FILE__, __LINE__); |
|
3803 | - $this->cache_filename .= '_par' . strtolower(md5($ParametersString)); |
|
3802 | + $this->DebugMessage('SetCacheFilename() _par set from md5('.$ParametersString.')', __FILE__, __LINE__); |
|
3803 | + $this->cache_filename .= '_par'.strtolower(md5($ParametersString)); |
|
3804 | 3804 | |
3805 | 3805 | if ($this->md5s) { |
3806 | 3806 | // source image MD5 hash provided |
3807 | 3807 | // do not source image modification date -- |
3808 | 3808 | // cached image will be used even if file was modified or removed |
3809 | 3809 | } elseif (!$this->config_cache_source_filemtime_ignore_remote && preg_match('#^(f|ht)tps?\://#i', $this->src)) { |
3810 | - $this->cache_filename .= '_dat' . (int)phpthumb_functions::filedate_remote($this->src); |
|
3810 | + $this->cache_filename .= '_dat'.(int)phpthumb_functions::filedate_remote($this->src); |
|
3811 | 3811 | } elseif (!$this->config_cache_source_filemtime_ignore_local && $this->src && !$this->rawImageData) { |
3812 | - $this->cache_filename .= '_dat' . (int)(@filemtime($this->sourceFilename)); |
|
3812 | + $this->cache_filename .= '_dat'.(int)(@filemtime($this->sourceFilename)); |
|
3813 | 3813 | } |
3814 | 3814 | |
3815 | - $this->cache_filename .= '.' . strtolower($this->thumbnailFormat); |
|
3816 | - $broad_directories = ''; |
|
3815 | + $this->cache_filename .= '.'.strtolower($this->thumbnailFormat); |
|
3816 | + $broad_directories = ''; |
|
3817 | 3817 | for ($i = 0; $i < $this->config_cache_directory_depth; $i++) { |
3818 | - $broad_directories .= DIRECTORY_SEPARATOR . substr($broad_directory_name, 0, $i + 1); |
|
3818 | + $broad_directories .= DIRECTORY_SEPARATOR.substr($broad_directory_name, 0, $i + 1); |
|
3819 | 3819 | } |
3820 | 3820 | |
3821 | - $this->cache_filename = $this->config_cache_directory . $broad_directories . DIRECTORY_SEPARATOR . $this->config_cache_prefix . rawurlencode($this->cache_filename); |
|
3821 | + $this->cache_filename = $this->config_cache_directory.$broad_directories.DIRECTORY_SEPARATOR.$this->config_cache_prefix.rawurlencode($this->cache_filename); |
|
3822 | 3822 | |
3823 | 3823 | return true; |
3824 | 3824 | } |
@@ -3853,7 +3853,7 @@ discard block |
||
3853 | 3853 | $ImageCreateWasAttempted = false; |
3854 | 3854 | $gd_image = false; |
3855 | 3855 | |
3856 | - $this->DebugMessage('starting ImageCreateFromFilename(' . $filename . ')', __FILE__, __LINE__); |
|
3856 | + $this->DebugMessage('starting ImageCreateFromFilename('.$filename.')', __FILE__, __LINE__); |
|
3857 | 3857 | if ($filename && ($getimagesizeinfo = @getimagesize($filename))) { |
3858 | 3858 | if (!$this->SourceImageIsTooLarge($getimagesizeinfo[0], $getimagesizeinfo[1])) { |
3859 | 3859 | $ImageCreateFromFunction = [ |
@@ -3862,7 +3862,7 @@ discard block |
||
3862 | 3862 | 3 => 'imagecreatefrompng', |
3863 | 3863 | 15 => 'imagecreatefromwbmp', |
3864 | 3864 | ]; |
3865 | - $this->DebugMessage('ImageCreateFromFilename found ($getimagesizeinfo[2]==' . @$getimagesizeinfo[2] . ')', __FILE__, __LINE__); |
|
3865 | + $this->DebugMessage('ImageCreateFromFilename found ($getimagesizeinfo[2]=='.@$getimagesizeinfo[2].')', __FILE__, __LINE__); |
|
3866 | 3866 | switch (@$getimagesizeinfo[2]) { |
3867 | 3867 | case 1: // GIF |
3868 | 3868 | case 2: // JPEG |
@@ -3870,11 +3870,11 @@ discard block |
||
3870 | 3870 | case 15: // WBMP |
3871 | 3871 | $ImageCreateFromFunctionName = $ImageCreateFromFunction[$getimagesizeinfo[2]]; |
3872 | 3872 | if (function_exists($ImageCreateFromFunctionName)) { |
3873 | - $this->DebugMessage('Calling ' . $ImageCreateFromFunctionName . '(' . $filename . ')', __FILE__, __LINE__); |
|
3873 | + $this->DebugMessage('Calling '.$ImageCreateFromFunctionName.'('.$filename.')', __FILE__, __LINE__); |
|
3874 | 3874 | $ImageCreateWasAttempted = true; |
3875 | 3875 | $gd_image = $ImageCreateFromFunctionName($filename); |
3876 | 3876 | } else { |
3877 | - $this->DebugMessage('NOT calling ' . $ImageCreateFromFunctionName . '(' . $filename . ') because !function_exists(' . $ImageCreateFromFunctionName . ')', __FILE__, __LINE__); |
|
3877 | + $this->DebugMessage('NOT calling '.$ImageCreateFromFunctionName.'('.$filename.') because !function_exists('.$ImageCreateFromFunctionName.')', __FILE__, __LINE__); |
|
3878 | 3878 | } |
3879 | 3879 | break; |
3880 | 3880 | |
@@ -3890,16 +3890,16 @@ discard block |
||
3890 | 3890 | case 13: // SWC |
3891 | 3891 | case 14: // IFF |
3892 | 3892 | case 16: // XBM |
3893 | - $this->DebugMessage('No built-in image creation function for image type "' . @$getimagesizeinfo[2] . '" ($getimagesizeinfo[2])', __FILE__, __LINE__); |
|
3893 | + $this->DebugMessage('No built-in image creation function for image type "'.@$getimagesizeinfo[2].'" ($getimagesizeinfo[2])', __FILE__, __LINE__); |
|
3894 | 3894 | break; |
3895 | 3895 | |
3896 | 3896 | default: |
3897 | - $this->DebugMessage('Unknown value for $getimagesizeinfo[2]: "' . @$getimagesizeinfo[2] . '"', __FILE__, __LINE__); |
|
3897 | + $this->DebugMessage('Unknown value for $getimagesizeinfo[2]: "'.@$getimagesizeinfo[2].'"', __FILE__, __LINE__); |
|
3898 | 3898 | break; |
3899 | 3899 | } |
3900 | 3900 | } else { |
3901 | 3901 | $this->DebugMessage( |
3902 | - 'image is ' . $getimagesizeinfo[0] . 'x' . $getimagesizeinfo[1] . ' and therefore contains more pixels (' . ($getimagesizeinfo[0] * $getimagesizeinfo[1]) . ') than $this->config_max_source_pixels setting (' . $this->config_max_source_pixels . ')', |
|
3902 | + 'image is '.$getimagesizeinfo[0].'x'.$getimagesizeinfo[1].' and therefore contains more pixels ('.($getimagesizeinfo[0] * $getimagesizeinfo[1]).') than $this->config_max_source_pixels setting ('.$this->config_max_source_pixels.')', |
|
3903 | 3903 | __FILE__, |
3904 | 3904 | __LINE__ |
3905 | 3905 | ); |
@@ -3907,13 +3907,13 @@ discard block |
||
3907 | 3907 | return false; |
3908 | 3908 | } |
3909 | 3909 | } else { |
3910 | - $this->DebugMessage('empty $filename or getimagesize(' . $filename . ') failed', __FILE__, __LINE__); |
|
3910 | + $this->DebugMessage('empty $filename or getimagesize('.$filename.') failed', __FILE__, __LINE__); |
|
3911 | 3911 | } |
3912 | 3912 | |
3913 | 3913 | if (!$gd_image) { |
3914 | 3914 | // cannot create from filename, attempt to create source image with imagecreatefromstring, if possible |
3915 | 3915 | if ($ImageCreateWasAttempted) { |
3916 | - $this->DebugMessage($ImageCreateFromFunctionName . '() was attempted but FAILED', __FILE__, __LINE__); |
|
3916 | + $this->DebugMessage($ImageCreateFromFunctionName.'() was attempted but FAILED', __FILE__, __LINE__); |
|
3917 | 3917 | } |
3918 | 3918 | $this->DebugMessage('Populating $rawimagedata', __FILE__, __LINE__); |
3919 | 3919 | $rawimagedata = ''; |
@@ -3926,10 +3926,10 @@ discard block |
||
3926 | 3926 | } |
3927 | 3927 | fclose($fp); |
3928 | 3928 | } else { |
3929 | - $this->DebugMessage('cannot fopen(' . $filename . ')', __FILE__, __LINE__); |
|
3929 | + $this->DebugMessage('cannot fopen('.$filename.')', __FILE__, __LINE__); |
|
3930 | 3930 | } |
3931 | 3931 | if ($rawimagedata) { |
3932 | - $this->DebugMessage('attempting ImageCreateFromStringReplacement($rawimagedata (' . strlen($rawimagedata) . ' bytes), true)', __FILE__, __LINE__); |
|
3932 | + $this->DebugMessage('attempting ImageCreateFromStringReplacement($rawimagedata ('.strlen($rawimagedata).' bytes), true)', __FILE__, __LINE__); |
|
3933 | 3933 | $gd_image = $this->ImageCreateFromStringReplacement($rawimagedata, true); |
3934 | 3934 | } |
3935 | 3935 | } |
@@ -3945,7 +3945,7 @@ discard block |
||
3945 | 3945 | if (is_resource($this->gdimg_source)) { |
3946 | 3946 | $this->source_width = imagesx($this->gdimg_source); |
3947 | 3947 | $this->source_height = imagesy($this->gdimg_source); |
3948 | - $this->DebugMessage('skipping SourceImageToGD() because $this->gdimg_source is already a resource (' . $this->source_width . 'x' . $this->source_height . ')', __FILE__, __LINE__); |
|
3948 | + $this->DebugMessage('skipping SourceImageToGD() because $this->gdimg_source is already a resource ('.$this->source_width.'x'.$this->source_height.')', __FILE__, __LINE__); |
|
3949 | 3949 | |
3950 | 3950 | return true; |
3951 | 3951 | } |
@@ -3964,7 +3964,7 @@ discard block |
||
3964 | 3964 | $this->DebugMessage('ImageMagickThumbnailToGD() failed', __FILE__, __LINE__); |
3965 | 3965 | } |
3966 | 3966 | } else { |
3967 | - $this->DebugMessage('failed to put $this->rawImageData into temp file "' . $tempnam . '"', __FILE__, __LINE__); |
|
3967 | + $this->DebugMessage('failed to put $this->rawImageData into temp file "'.$tempnam.'"', __FILE__, __LINE__); |
|
3968 | 3968 | } |
3969 | 3969 | } else { |
3970 | 3970 | $this->DebugMessage('failed to generate temp file name', __FILE__, __LINE__); |
@@ -3988,7 +3988,7 @@ discard block |
||
3988 | 3988 | . 'M).'); |
3989 | 3989 | } |
3990 | 3990 | if ($this->md5s && ($this->md5s != md5($this->rawImageData))) { |
3991 | - return $this->ErrorImage('$this->md5s != md5($this->rawImageData)' . "\n" . '"' . $this->md5s . '" != ' . "\n" . '"' . md5($this->rawImageData) . '"'); |
|
3991 | + return $this->ErrorImage('$this->md5s != md5($this->rawImageData)'."\n".'"'.$this->md5s.'" != '."\n".'"'.md5($this->rawImageData).'"'); |
|
3992 | 3992 | } |
3993 | 3993 | //if ($this->issafemode) { |
3994 | 3994 | // return $this->ErrorImage('Cannot generate thumbnails from raw image data when PHP SAFE_MODE enabled'); |
@@ -3997,17 +3997,17 @@ discard block |
||
3997 | 3997 | if (!$this->gdimg_source) { |
3998 | 3998 | if ('BM' === substr($this->rawImageData, 0, 2)) { |
3999 | 3999 | $this->getimagesizeinfo[2] = 6; // BMP |
4000 | - } elseif (substr($this->rawImageData, 0, 4) === 'II' . "\x2A\x00") { |
|
4000 | + } elseif (substr($this->rawImageData, 0, 4) === 'II'."\x2A\x00") { |
|
4001 | 4001 | $this->getimagesizeinfo[2] = 7; // TIFF (littlendian) |
4002 | - } elseif (substr($this->rawImageData, 0, 4) === 'MM' . "\x00\x2A") { |
|
4002 | + } elseif (substr($this->rawImageData, 0, 4) === 'MM'."\x00\x2A") { |
|
4003 | 4003 | $this->getimagesizeinfo[2] = 8; // TIFF (bigendian) |
4004 | 4004 | } |
4005 | - $this->DebugMessage('SourceImageToGD.ImageCreateFromStringReplacement() failed with unknown image type "' . substr($this->rawImageData, 0, 4) . '" (' . phpthumb_functions::HexCharDisplay(substr($this->rawImageData, 0, 4)) . ')', __FILE__, __LINE__); |
|
4005 | + $this->DebugMessage('SourceImageToGD.ImageCreateFromStringReplacement() failed with unknown image type "'.substr($this->rawImageData, 0, 4).'" ('.phpthumb_functions::HexCharDisplay(substr($this->rawImageData, 0, 4)).')', __FILE__, __LINE__); |
|
4006 | 4006 | // return $this->ErrorImage('Unknown image type identified by "'.substr($this->rawImageData, 0, 4).'" ('.phpthumb_functions::HexCharDisplay(substr($this->rawImageData, 0, 4)).') in SourceImageToGD()['.__LINE__.']'); |
4007 | 4007 | } |
4008 | 4008 | } elseif (!$this->gdimg_source && $this->sourceFilename) { |
4009 | 4009 | if ($this->md5s && ($this->md5s != phpthumb_functions::md5_file_safe($this->sourceFilename))) { |
4010 | - return $this->ErrorImage('$this->md5s != md5(sourceFilename)' . "\n" . '"' . $this->md5s . '" != ' . "\n" . '"' . phpthumb_functions::md5_file_safe($this->sourceFilename) . '"'); |
|
4010 | + return $this->ErrorImage('$this->md5s != md5(sourceFilename)'."\n".'"'.$this->md5s.'" != '."\n".'"'.phpthumb_functions::md5_file_safe($this->sourceFilename).'"'); |
|
4011 | 4011 | } |
4012 | 4012 | switch (@$this->getimagesizeinfo[2]) { |
4013 | 4013 | case 1: |
@@ -4043,17 +4043,17 @@ discard block |
||
4043 | 4043 | break; |
4044 | 4044 | } |
4045 | 4045 | if ((0 != $this->thumbnailCropX) || (0 != $this->thumbnailCropY)) { |
4046 | - $this->DebugMessage('Not using EXIF thumbnail data because source cropping is enabled (' . $this->thumbnailCropX . ',' . $this->thumbnailCropY . ')', __FILE__, __LINE__); |
|
4046 | + $this->DebugMessage('Not using EXIF thumbnail data because source cropping is enabled ('.$this->thumbnailCropX.','.$this->thumbnailCropY.')', __FILE__, __LINE__); |
|
4047 | 4047 | break; |
4048 | 4048 | } |
4049 | 4049 | if (($this->w > $this->exif_thumbnail_width) || ($this->h > $this->exif_thumbnail_height)) { |
4050 | - $this->DebugMessage('Not using EXIF thumbnail data because EXIF thumbnail is too small (' . $this->exif_thumbnail_width . 'x' . $this->exif_thumbnail_height . ' vs ' . $this->w . 'x' . $this->h . ')', __FILE__, __LINE__); |
|
4050 | + $this->DebugMessage('Not using EXIF thumbnail data because EXIF thumbnail is too small ('.$this->exif_thumbnail_width.'x'.$this->exif_thumbnail_height.' vs '.$this->w.'x'.$this->h.')', __FILE__, __LINE__); |
|
4051 | 4051 | break; |
4052 | 4052 | } |
4053 | 4053 | $source_ar = $this->source_width / $this->source_height; |
4054 | 4054 | $exif_ar = $this->exif_thumbnail_width / $this->exif_thumbnail_height; |
4055 | 4055 | if (number_format($source_ar, 2) != number_format($exif_ar, 2)) { |
4056 | - $this->DebugMessage('not using EXIF thumbnail because $source_ar != $exif_ar (' . $source_ar . ' != ' . $exif_ar . ')', __FILE__, __LINE__); |
|
4056 | + $this->DebugMessage('not using EXIF thumbnail because $source_ar != $exif_ar ('.$source_ar.' != '.$exif_ar.')', __FILE__, __LINE__); |
|
4057 | 4057 | break; |
4058 | 4058 | } |
4059 | 4059 | } |
@@ -4128,15 +4128,15 @@ discard block |
||
4128 | 4128 | . ceil(($memory_get_usage + (5 * $this->getimagesizeinfo[0] * $this->getimagesizeinfo[1])) / 1048576) |
4129 | 4129 | . 'M).'; |
4130 | 4130 | } elseif (!$GDreadSupport) { |
4131 | - $errormessages[] = 'GD does not have read support for "' . $imageHeader . '".'; |
|
4131 | + $errormessages[] = 'GD does not have read support for "'.$imageHeader.'".'; |
|
4132 | 4132 | } else { |
4133 | 4133 | $errormessages[] = 'Source image probably corrupt.'; |
4134 | 4134 | } |
4135 | 4135 | $this->ErrorImage(implode("\n", $errormessages)); |
4136 | 4136 | } else { |
4137 | - $this->DebugMessage('All attempts to create GD image source failed (' . (ini_get('safe_mode') ? 'Safe Mode enabled, ImageMagick unavailable and source image probably too large for GD' : ($GDreadSupport ? 'source image probably corrupt' : 'GD does not have read support for "' |
|
4137 | + $this->DebugMessage('All attempts to create GD image source failed ('.(ini_get('safe_mode') ? 'Safe Mode enabled, ImageMagick unavailable and source image probably too large for GD' : ($GDreadSupport ? 'source image probably corrupt' : 'GD does not have read support for "' |
|
4138 | 4138 | . $imageHeader |
4139 | - . '"')) . '), cannot generate thumbnail'); |
|
4139 | + . '"')).'), cannot generate thumbnail'); |
|
4140 | 4140 | //$this->DebugMessage('All attempts to create GD image source failed ('.($GDreadSupport ? 'source image probably corrupt' : 'GD does not have read support for "'.$imageHeader.'"').'), outputing raw image', __FILE__, __LINE__); |
4141 | 4141 | //if (!$this->phpThumbDebug) { |
4142 | 4142 | // header($imageHeader); |
@@ -4152,10 +4152,10 @@ discard block |
||
4152 | 4152 | switch (@$this->getimagesizeinfo[2]) { |
4153 | 4153 | case 6: |
4154 | 4154 | ob_start(); |
4155 | - if (!@require_once __DIR__ . '/phpthumb.bmp.php') { |
|
4155 | + if (!@require_once __DIR__.'/phpthumb.bmp.php') { |
|
4156 | 4156 | ob_end_clean(); |
4157 | 4157 | |
4158 | - return $this->ErrorImage('include_once(' . __DIR__ . '/phpthumb.bmp.php) failed'); |
|
4158 | + return $this->ErrorImage('include_once('.__DIR__.'/phpthumb.bmp.php) failed'); |
|
4159 | 4159 | } |
4160 | 4160 | ob_end_clean(); |
4161 | 4161 | if ($fp = @fopen($this->sourceFilename, 'rb')) { |
@@ -4196,10 +4196,10 @@ discard block |
||
4196 | 4196 | $HeaderFourBytes = fread($fp, 4); |
4197 | 4197 | fclose($fp); |
4198 | 4198 | } else { |
4199 | - return $this->ErrorImage('failed to open "' . $this->sourceFilename . '" SourceImageToGD() [' . __LINE__ . ']'); |
|
4199 | + return $this->ErrorImage('failed to open "'.$this->sourceFilename.'" SourceImageToGD() ['.__LINE__.']'); |
|
4200 | 4200 | } |
4201 | 4201 | } else { |
4202 | - return $this->ErrorImage('Unable to create image, neither filename nor image data suppplied in SourceImageToGD() [' . __LINE__ . ']'); |
|
4202 | + return $this->ErrorImage('Unable to create image, neither filename nor image data suppplied in SourceImageToGD() ['.__LINE__.']'); |
|
4203 | 4203 | } |
4204 | 4204 | if (!$this->ImageMagickVersion() && !phpthumb_functions::gd_version()) { |
4205 | 4205 | return $this->ErrorImage('Neither GD nor ImageMagick seem to be installed on this server. At least one (preferably GD), or better both, MUST be installed for phpThumb to work.'); |
@@ -4215,7 +4215,7 @@ discard block |
||
4215 | 4215 | return $this->ErrorImage('Image (GIF) is too large for PHP-GD memory_limit, please install ImageMagick or increase php.ini memory_limit setting'); |
4216 | 4216 | } |
4217 | 4217 | |
4218 | - return $this->ErrorImage('Unknown image type identified by "' . $HeaderFourBytes . '" (' . phpthumb_functions::HexCharDisplay($HeaderFourBytes) . ') in SourceImageToGD() [' . __LINE__ . ']'); |
|
4218 | + return $this->ErrorImage('Unknown image type identified by "'.$HeaderFourBytes.'" ('.phpthumb_functions::HexCharDisplay($HeaderFourBytes).') in SourceImageToGD() ['.__LINE__.']'); |
|
4219 | 4219 | } |
4220 | 4220 | } |
4221 | 4221 | |
@@ -4250,11 +4250,11 @@ discard block |
||
4250 | 4250 | } elseif (is_bool($var)) { |
4251 | 4251 | return ($var ? 'TRUE' : 'FALSE'); |
4252 | 4252 | } elseif (is_string($var)) { |
4253 | - return 'string(' . strlen($var) . ')' . str_repeat(' ', max(0, 3 - strlen(strlen($var)))) . ' "' . $var . '"'; |
|
4253 | + return 'string('.strlen($var).')'.str_repeat(' ', max(0, 3 - strlen(strlen($var)))).' "'.$var.'"'; |
|
4254 | 4254 | } elseif (is_int($var)) { |
4255 | - return 'integer ' . $var; |
|
4255 | + return 'integer '.$var; |
|
4256 | 4256 | } elseif (is_float($var)) { |
4257 | - return 'float ' . $var; |
|
4257 | + return 'float '.$var; |
|
4258 | 4258 | } elseif (is_array($var)) { |
4259 | 4259 | ob_start(); |
4260 | 4260 | var_dump($var); |
@@ -4280,7 +4280,7 @@ discard block |
||
4280 | 4280 | return $this->ErrorImage('phpThumbDebug disabled'); |
4281 | 4281 | } |
4282 | 4282 | |
4283 | - $FunctionsExistance = [ |
|
4283 | + $FunctionsExistance = [ |
|
4284 | 4284 | 'exif_thumbnail', |
4285 | 4285 | 'gd_info', |
4286 | 4286 | 'image_type_to_mime_type', |
@@ -4309,7 +4309,7 @@ discard block |
||
4309 | 4309 | 'imagepng', |
4310 | 4310 | 'imagewbmp' |
4311 | 4311 | ]; |
4312 | - $ParameterNames = [ |
|
4312 | + $ParameterNames = [ |
|
4313 | 4313 | 'src', |
4314 | 4314 | 'new', |
4315 | 4315 | 'w', |
@@ -4366,7 +4366,7 @@ discard block |
||
4366 | 4366 | 'disable_pathinfo_parsing', |
4367 | 4367 | 'disable_imagecopyresampled' |
4368 | 4368 | ]; |
4369 | - $OtherVariableNames = [ |
|
4369 | + $OtherVariableNames = [ |
|
4370 | 4370 | 'phpThumbDebug', |
4371 | 4371 | 'thumbnailQuality', |
4372 | 4372 | 'thumbnailFormat', |
@@ -4389,101 +4389,101 @@ discard block |
||
4389 | 4389 | ]; |
4390 | 4390 | |
4391 | 4391 | $DebugOutput = []; |
4392 | - $DebugOutput[] = 'phpThumb() version = ' . $this->phpthumb_version; |
|
4393 | - $DebugOutput[] = 'PHP_VERSION = ' . @PHP_VERSION; |
|
4394 | - $DebugOutput[] = 'PHP_OS = ' . PHP_OS; |
|
4395 | - $DebugOutput[] = '$_SERVER[SERVER_SOFTWARE] = ' . @$_SERVER['SERVER_SOFTWARE']; |
|
4396 | - $DebugOutput[] = '__FILE__ = ' . __FILE__; |
|
4397 | - $DebugOutput[] = 'realpath(.) = ' . @realpath('.'); |
|
4398 | - $DebugOutput[] = '$_SERVER[PHP_SELF] = ' . @$_SERVER['PHP_SELF']; |
|
4399 | - $DebugOutput[] = '$_SERVER[HOST_NAME] = ' . @$_SERVER['HOST_NAME']; |
|
4400 | - $DebugOutput[] = '$_SERVER[HTTP_REFERER] = ' . @$_SERVER['HTTP_REFERER']; |
|
4401 | - $DebugOutput[] = '$_SERVER[QUERY_STRING] = ' . @$_SERVER['QUERY_STRING']; |
|
4402 | - $DebugOutput[] = '$_SERVER[PATH_INFO] = ' . @$_SERVER['PATH_INFO']; |
|
4403 | - $DebugOutput[] = '$_SERVER[DOCUMENT_ROOT] = ' . @$_SERVER['DOCUMENT_ROOT']; |
|
4404 | - $DebugOutput[] = 'getenv(DOCUMENT_ROOT) = ' . @getenv('DOCUMENT_ROOT'); |
|
4392 | + $DebugOutput[] = 'phpThumb() version = '.$this->phpthumb_version; |
|
4393 | + $DebugOutput[] = 'PHP_VERSION = '.@PHP_VERSION; |
|
4394 | + $DebugOutput[] = 'PHP_OS = '.PHP_OS; |
|
4395 | + $DebugOutput[] = '$_SERVER[SERVER_SOFTWARE] = '.@$_SERVER['SERVER_SOFTWARE']; |
|
4396 | + $DebugOutput[] = '__FILE__ = '.__FILE__; |
|
4397 | + $DebugOutput[] = 'realpath(.) = '.@realpath('.'); |
|
4398 | + $DebugOutput[] = '$_SERVER[PHP_SELF] = '.@$_SERVER['PHP_SELF']; |
|
4399 | + $DebugOutput[] = '$_SERVER[HOST_NAME] = '.@$_SERVER['HOST_NAME']; |
|
4400 | + $DebugOutput[] = '$_SERVER[HTTP_REFERER] = '.@$_SERVER['HTTP_REFERER']; |
|
4401 | + $DebugOutput[] = '$_SERVER[QUERY_STRING] = '.@$_SERVER['QUERY_STRING']; |
|
4402 | + $DebugOutput[] = '$_SERVER[PATH_INFO] = '.@$_SERVER['PATH_INFO']; |
|
4403 | + $DebugOutput[] = '$_SERVER[DOCUMENT_ROOT] = '.@$_SERVER['DOCUMENT_ROOT']; |
|
4404 | + $DebugOutput[] = 'getenv(DOCUMENT_ROOT) = '.@getenv('DOCUMENT_ROOT'); |
|
4405 | 4405 | $DebugOutput[] = ''; |
4406 | 4406 | |
4407 | - $DebugOutput[] = 'get_magic_quotes_gpc() = ' . $this->phpThumbDebugVarDump(@get_magic_quotes_gpc()); |
|
4408 | - $DebugOutput[] = 'get_magic_quotes_runtime() = ' . $this->phpThumbDebugVarDump(@get_magic_quotes_runtime()); |
|
4409 | - $DebugOutput[] = 'error_reporting() = ' . $this->phpThumbDebugVarDump(error_reporting()); |
|
4410 | - $DebugOutput[] = 'ini_get(error_reporting) = ' . $this->phpThumbDebugVarDump(@ini_get('error_reporting')); |
|
4411 | - $DebugOutput[] = 'ini_get(display_errors) = ' . $this->phpThumbDebugVarDump(@ini_get('display_errors')); |
|
4412 | - $DebugOutput[] = 'ini_get(allow_url_fopen) = ' . $this->phpThumbDebugVarDump(@ini_get('allow_url_fopen')); |
|
4413 | - $DebugOutput[] = 'ini_get(disable_functions) = ' . $this->phpThumbDebugVarDump(@ini_get('disable_functions')); |
|
4414 | - $DebugOutput[] = 'get_cfg_var(disable_functions) = ' . $this->phpThumbDebugVarDump(@get_cfg_var('disable_functions')); |
|
4415 | - $DebugOutput[] = 'ini_get(safe_mode) = ' . $this->phpThumbDebugVarDump(@ini_get('safe_mode')); |
|
4416 | - $DebugOutput[] = 'ini_get(open_basedir) = ' . $this->phpThumbDebugVarDump(@ini_get('open_basedir')); |
|
4417 | - $DebugOutput[] = 'ini_get(max_execution_time) = ' . $this->phpThumbDebugVarDump(@ini_get('max_execution_time')); |
|
4418 | - $DebugOutput[] = 'ini_get(memory_limit) = ' . $this->phpThumbDebugVarDump(@ini_get('memory_limit')); |
|
4419 | - $DebugOutput[] = 'get_cfg_var(memory_limit) = ' . $this->phpThumbDebugVarDump(@get_cfg_var('memory_limit')); |
|
4420 | - $DebugOutput[] = 'memory_get_usage() = ' . (function_exists('memory_get_usage') ? $this->phpThumbDebugVarDump(@memory_get_usage()) : 'n/a'); |
|
4407 | + $DebugOutput[] = 'get_magic_quotes_gpc() = '.$this->phpThumbDebugVarDump(@get_magic_quotes_gpc()); |
|
4408 | + $DebugOutput[] = 'get_magic_quotes_runtime() = '.$this->phpThumbDebugVarDump(@get_magic_quotes_runtime()); |
|
4409 | + $DebugOutput[] = 'error_reporting() = '.$this->phpThumbDebugVarDump(error_reporting()); |
|
4410 | + $DebugOutput[] = 'ini_get(error_reporting) = '.$this->phpThumbDebugVarDump(@ini_get('error_reporting')); |
|
4411 | + $DebugOutput[] = 'ini_get(display_errors) = '.$this->phpThumbDebugVarDump(@ini_get('display_errors')); |
|
4412 | + $DebugOutput[] = 'ini_get(allow_url_fopen) = '.$this->phpThumbDebugVarDump(@ini_get('allow_url_fopen')); |
|
4413 | + $DebugOutput[] = 'ini_get(disable_functions) = '.$this->phpThumbDebugVarDump(@ini_get('disable_functions')); |
|
4414 | + $DebugOutput[] = 'get_cfg_var(disable_functions) = '.$this->phpThumbDebugVarDump(@get_cfg_var('disable_functions')); |
|
4415 | + $DebugOutput[] = 'ini_get(safe_mode) = '.$this->phpThumbDebugVarDump(@ini_get('safe_mode')); |
|
4416 | + $DebugOutput[] = 'ini_get(open_basedir) = '.$this->phpThumbDebugVarDump(@ini_get('open_basedir')); |
|
4417 | + $DebugOutput[] = 'ini_get(max_execution_time) = '.$this->phpThumbDebugVarDump(@ini_get('max_execution_time')); |
|
4418 | + $DebugOutput[] = 'ini_get(memory_limit) = '.$this->phpThumbDebugVarDump(@ini_get('memory_limit')); |
|
4419 | + $DebugOutput[] = 'get_cfg_var(memory_limit) = '.$this->phpThumbDebugVarDump(@get_cfg_var('memory_limit')); |
|
4420 | + $DebugOutput[] = 'memory_get_usage() = '.(function_exists('memory_get_usage') ? $this->phpThumbDebugVarDump(@memory_get_usage()) : 'n/a'); |
|
4421 | 4421 | $DebugOutput[] = ''; |
4422 | 4422 | |
4423 | - $DebugOutput[] = '$this->config_prefer_imagemagick = ' . $this->phpThumbDebugVarDump($this->config_prefer_imagemagick); |
|
4424 | - $DebugOutput[] = '$this->config_imagemagick_path = ' . $this->phpThumbDebugVarDump($this->config_imagemagick_path); |
|
4425 | - $DebugOutput[] = '$this->ImageMagickWhichConvert() = ' . $this->ImageMagickWhichConvert(); |
|
4423 | + $DebugOutput[] = '$this->config_prefer_imagemagick = '.$this->phpThumbDebugVarDump($this->config_prefer_imagemagick); |
|
4424 | + $DebugOutput[] = '$this->config_imagemagick_path = '.$this->phpThumbDebugVarDump($this->config_imagemagick_path); |
|
4425 | + $DebugOutput[] = '$this->ImageMagickWhichConvert() = '.$this->ImageMagickWhichConvert(); |
|
4426 | 4426 | $IMpathUsed = ($this->config_imagemagick_path ?: $this->ImageMagickWhichConvert()); |
4427 | - $DebugOutput[] = '[actual ImageMagick path used] = ' . $this->phpThumbDebugVarDump($IMpathUsed); |
|
4428 | - $DebugOutput[] = 'file_exists([actual ImageMagick path used]) = ' . $this->phpThumbDebugVarDump(@file_exists($IMpathUsed)); |
|
4429 | - $DebugOutput[] = 'ImageMagickVersion(false) = ' . $this->ImageMagickVersion(false); |
|
4430 | - $DebugOutput[] = 'ImageMagickVersion(true) = ' . $this->ImageMagickVersion(true); |
|
4427 | + $DebugOutput[] = '[actual ImageMagick path used] = '.$this->phpThumbDebugVarDump($IMpathUsed); |
|
4428 | + $DebugOutput[] = 'file_exists([actual ImageMagick path used]) = '.$this->phpThumbDebugVarDump(@file_exists($IMpathUsed)); |
|
4429 | + $DebugOutput[] = 'ImageMagickVersion(false) = '.$this->ImageMagickVersion(false); |
|
4430 | + $DebugOutput[] = 'ImageMagickVersion(true) = '.$this->ImageMagickVersion(true); |
|
4431 | 4431 | $DebugOutput[] = ''; |
4432 | 4432 | |
4433 | - $DebugOutput[] = '$this->config_cache_directory = ' . $this->phpThumbDebugVarDump($this->config_cache_directory); |
|
4434 | - $DebugOutput[] = '$this->config_cache_directory_depth = ' . $this->phpThumbDebugVarDump($this->config_cache_directory_depth); |
|
4435 | - $DebugOutput[] = '$this->config_cache_disable_warning = ' . $this->phpThumbDebugVarDump($this->config_cache_disable_warning); |
|
4436 | - $DebugOutput[] = '$this->config_cache_maxage = ' . $this->phpThumbDebugVarDump($this->config_cache_maxage); |
|
4437 | - $DebugOutput[] = '$this->config_cache_maxsize = ' . $this->phpThumbDebugVarDump($this->config_cache_maxsize); |
|
4438 | - $DebugOutput[] = '$this->config_cache_maxfiles = ' . $this->phpThumbDebugVarDump($this->config_cache_maxfiles); |
|
4439 | - $DebugOutput[] = '$this->config_cache_force_passthru = ' . $this->phpThumbDebugVarDump($this->config_cache_force_passthru); |
|
4440 | - $DebugOutput[] = '$this->cache_filename = ' . $this->phpThumbDebugVarDump($this->cache_filename); |
|
4441 | - $DebugOutput[] = 'is_readable($this->config_cache_directory) = ' . $this->phpThumbDebugVarDump(@is_readable($this->config_cache_directory)); |
|
4442 | - $DebugOutput[] = 'is_writable($this->config_cache_directory) = ' . $this->phpThumbDebugVarDump(@is_writable($this->config_cache_directory)); |
|
4443 | - $DebugOutput[] = 'is_readable($this->cache_filename) = ' . $this->phpThumbDebugVarDump(@is_readable($this->cache_filename)); |
|
4444 | - $DebugOutput[] = 'is_writable($this->cache_filename) = ' . (@file_exists($this->cache_filename) ? $this->phpThumbDebugVarDump(@is_writable($this->cache_filename)) : 'n/a'); |
|
4433 | + $DebugOutput[] = '$this->config_cache_directory = '.$this->phpThumbDebugVarDump($this->config_cache_directory); |
|
4434 | + $DebugOutput[] = '$this->config_cache_directory_depth = '.$this->phpThumbDebugVarDump($this->config_cache_directory_depth); |
|
4435 | + $DebugOutput[] = '$this->config_cache_disable_warning = '.$this->phpThumbDebugVarDump($this->config_cache_disable_warning); |
|
4436 | + $DebugOutput[] = '$this->config_cache_maxage = '.$this->phpThumbDebugVarDump($this->config_cache_maxage); |
|
4437 | + $DebugOutput[] = '$this->config_cache_maxsize = '.$this->phpThumbDebugVarDump($this->config_cache_maxsize); |
|
4438 | + $DebugOutput[] = '$this->config_cache_maxfiles = '.$this->phpThumbDebugVarDump($this->config_cache_maxfiles); |
|
4439 | + $DebugOutput[] = '$this->config_cache_force_passthru = '.$this->phpThumbDebugVarDump($this->config_cache_force_passthru); |
|
4440 | + $DebugOutput[] = '$this->cache_filename = '.$this->phpThumbDebugVarDump($this->cache_filename); |
|
4441 | + $DebugOutput[] = 'is_readable($this->config_cache_directory) = '.$this->phpThumbDebugVarDump(@is_readable($this->config_cache_directory)); |
|
4442 | + $DebugOutput[] = 'is_writable($this->config_cache_directory) = '.$this->phpThumbDebugVarDump(@is_writable($this->config_cache_directory)); |
|
4443 | + $DebugOutput[] = 'is_readable($this->cache_filename) = '.$this->phpThumbDebugVarDump(@is_readable($this->cache_filename)); |
|
4444 | + $DebugOutput[] = 'is_writable($this->cache_filename) = '.(@file_exists($this->cache_filename) ? $this->phpThumbDebugVarDump(@is_writable($this->cache_filename)) : 'n/a'); |
|
4445 | 4445 | $DebugOutput[] = ''; |
4446 | 4446 | |
4447 | 4447 | foreach ($ConfigVariableNames as $varname) { |
4448 | - $varname = 'config_' . $varname; |
|
4448 | + $varname = 'config_'.$varname; |
|
4449 | 4449 | $value = $this->$varname; |
4450 | - $DebugOutput[] = '$this->' . str_pad($varname, 37, ' ', STR_PAD_RIGHT) . ' = ' . $this->phpThumbDebugVarDump($value); |
|
4450 | + $DebugOutput[] = '$this->'.str_pad($varname, 37, ' ', STR_PAD_RIGHT).' = '.$this->phpThumbDebugVarDump($value); |
|
4451 | 4451 | } |
4452 | 4452 | $DebugOutput[] = ''; |
4453 | 4453 | foreach ($OtherVariableNames as $varname) { |
4454 | 4454 | $value = $this->$varname; |
4455 | - $DebugOutput[] = '$this->' . str_pad($varname, 27, ' ', STR_PAD_RIGHT) . ' = ' . $this->phpThumbDebugVarDump($value); |
|
4455 | + $DebugOutput[] = '$this->'.str_pad($varname, 27, ' ', STR_PAD_RIGHT).' = '.$this->phpThumbDebugVarDump($value); |
|
4456 | 4456 | } |
4457 | - $DebugOutput[] = 'strlen($this->rawImageData) = ' . strlen(@$this->rawImageData); |
|
4458 | - $DebugOutput[] = 'strlen($this->exif_thumbnail_data) = ' . strlen(@$this->exif_thumbnail_data); |
|
4457 | + $DebugOutput[] = 'strlen($this->rawImageData) = '.strlen(@$this->rawImageData); |
|
4458 | + $DebugOutput[] = 'strlen($this->exif_thumbnail_data) = '.strlen(@$this->exif_thumbnail_data); |
|
4459 | 4459 | $DebugOutput[] = ''; |
4460 | 4460 | |
4461 | 4461 | foreach ($ParameterNames as $varname) { |
4462 | 4462 | $value = $this->$varname; |
4463 | - $DebugOutput[] = '$this->' . str_pad($varname, 4, ' ', STR_PAD_RIGHT) . ' = ' . $this->phpThumbDebugVarDump($value); |
|
4463 | + $DebugOutput[] = '$this->'.str_pad($varname, 4, ' ', STR_PAD_RIGHT).' = '.$this->phpThumbDebugVarDump($value); |
|
4464 | 4464 | } |
4465 | 4465 | $DebugOutput[] = ''; |
4466 | 4466 | |
4467 | 4467 | foreach ($FunctionsExistance as $functionname) { |
4468 | - $DebugOutput[] = 'builtin_function_exists(' . $functionname . ')' . str_repeat(' ', 23 - strlen($functionname)) . ' = ' . $this->phpThumbDebugVarDump(phpthumb_functions::builtin_function_exists($functionname)); |
|
4468 | + $DebugOutput[] = 'builtin_function_exists('.$functionname.')'.str_repeat(' ', 23 - strlen($functionname)).' = '.$this->phpThumbDebugVarDump(phpthumb_functions::builtin_function_exists($functionname)); |
|
4469 | 4469 | } |
4470 | 4470 | $DebugOutput[] = ''; |
4471 | 4471 | |
4472 | 4472 | $gd_info = gd_info(); |
4473 | 4473 | foreach ($gd_info as $key => $value) { |
4474 | - $DebugOutput[] = 'gd_info.' . str_pad($key, 34, ' ', STR_PAD_RIGHT) . ' = ' . $this->phpThumbDebugVarDump($value); |
|
4474 | + $DebugOutput[] = 'gd_info.'.str_pad($key, 34, ' ', STR_PAD_RIGHT).' = '.$this->phpThumbDebugVarDump($value); |
|
4475 | 4475 | } |
4476 | 4476 | $DebugOutput[] = ''; |
4477 | 4477 | |
4478 | 4478 | $exif_info = phpthumb_functions::exif_info(); |
4479 | 4479 | foreach ($exif_info as $key => $value) { |
4480 | - $DebugOutput[] = 'exif_info.' . str_pad($key, 26, ' ', STR_PAD_RIGHT) . ' = ' . $this->phpThumbDebugVarDump($value); |
|
4480 | + $DebugOutput[] = 'exif_info.'.str_pad($key, 26, ' ', STR_PAD_RIGHT).' = '.$this->phpThumbDebugVarDump($value); |
|
4481 | 4481 | } |
4482 | 4482 | $DebugOutput[] = ''; |
4483 | 4483 | |
4484 | 4484 | if ($ApacheLookupURIarray = phpthumb_functions::ApacheLookupURIarray(dirname(@$_SERVER['PHP_SELF']))) { |
4485 | 4485 | foreach ($ApacheLookupURIarray as $key => $value) { |
4486 | - $DebugOutput[] = 'ApacheLookupURIarray.' . str_pad($key, 15, ' ', STR_PAD_RIGHT) . ' = ' . $this->phpThumbDebugVarDump($value); |
|
4486 | + $DebugOutput[] = 'ApacheLookupURIarray.'.str_pad($key, 15, ' ', STR_PAD_RIGHT).' = '.$this->phpThumbDebugVarDump($value); |
|
4487 | 4487 | } |
4488 | 4488 | } else { |
4489 | 4489 | $DebugOutput[] = 'ApacheLookupURIarray() -- FAILED'; |
@@ -4492,27 +4492,27 @@ discard block |
||
4492 | 4492 | |
4493 | 4493 | if (isset($_GET) && is_array($_GET)) { |
4494 | 4494 | foreach ($_GET as $key => $value) { |
4495 | - $DebugOutput[] = '$_GET[' . $key . ']' . str_repeat(' ', 30 - strlen($key)) . '= ' . $this->phpThumbDebugVarDump($value); |
|
4495 | + $DebugOutput[] = '$_GET['.$key.']'.str_repeat(' ', 30 - strlen($key)).'= '.$this->phpThumbDebugVarDump($value); |
|
4496 | 4496 | } |
4497 | 4497 | } |
4498 | 4498 | if (isset($_POST) && is_array($_POST)) { |
4499 | 4499 | foreach ($_POST as $key => $value) { |
4500 | - $DebugOutput[] = '$_POST[' . $key . ']' . str_repeat(' ', 29 - strlen($key)) . '= ' . $this->phpThumbDebugVarDump($value); |
|
4500 | + $DebugOutput[] = '$_POST['.$key.']'.str_repeat(' ', 29 - strlen($key)).'= '.$this->phpThumbDebugVarDump($value); |
|
4501 | 4501 | } |
4502 | 4502 | } |
4503 | 4503 | $DebugOutput[] = ''; |
4504 | 4504 | |
4505 | 4505 | $DebugOutput[] = '$this->debugmessages:'; |
4506 | 4506 | foreach ($this->debugmessages as $errorstring) { |
4507 | - $DebugOutput[] = ' * ' . $errorstring; |
|
4507 | + $DebugOutput[] = ' * '.$errorstring; |
|
4508 | 4508 | } |
4509 | 4509 | $DebugOutput[] = ''; |
4510 | 4510 | |
4511 | 4511 | $DebugOutput[] = '$this->debugtiming:'; |
4512 | 4512 | foreach ($this->debugtiming as $timestamp => $timingstring) { |
4513 | - $DebugOutput[] = ' * ' . $timestamp . ' ' . $timingstring; |
|
4513 | + $DebugOutput[] = ' * '.$timestamp.' '.$timingstring; |
|
4514 | 4514 | } |
4515 | - $DebugOutput[] = ' * Total processing time: ' . number_format(max(array_keys($this->debugtiming)) - min(array_keys($this->debugtiming)), 6); |
|
4515 | + $DebugOutput[] = ' * Total processing time: '.number_format(max(array_keys($this->debugtiming)) - min(array_keys($this->debugtiming)), 6); |
|
4516 | 4516 | |
4517 | 4517 | $this->f = (isset($_GET['f']) ? $_GET['f'] : $this->f); // debug modes 0-2 don't recognize text mode otherwise |
4518 | 4518 | |
@@ -4544,7 +4544,7 @@ discard block |
||
4544 | 4544 | $width = ($width ?: $this->config_error_image_width); |
4545 | 4545 | $height = ($height ?: $this->config_error_image_height); |
4546 | 4546 | |
4547 | - $text = 'phpThumb() v' . $this->phpthumb_version . "\n" . 'http://phpthumb.sourceforge.net' . "\n\n" . ($this->config_disable_debug ? 'Error messages disabled.' |
|
4547 | + $text = 'phpThumb() v'.$this->phpthumb_version."\n".'http://phpthumb.sourceforge.net'."\n\n".($this->config_disable_debug ? 'Error messages disabled.' |
|
4548 | 4548 | . "\n\n" |
4549 | 4549 | . 'edit phpThumb.config.php and (temporarily) set' |
4550 | 4550 | . "\n" |
@@ -4570,7 +4570,7 @@ discard block |
||
4570 | 4570 | if (('showerror' === $this->err) || $this->phpThumbDebug) { |
4571 | 4571 | // fall through and actually show error message even if default error image is set |
4572 | 4572 | } else { |
4573 | - header('Location: ' . ($this->err ?: $this->config_error_message_image_default)); |
|
4573 | + header('Location: '.($this->err ?: $this->config_error_message_image_default)); |
|
4574 | 4574 | exit; |
4575 | 4575 | } |
4576 | 4576 | } |
@@ -4584,7 +4584,7 @@ discard block |
||
4584 | 4584 | header('Content-type: text/plain'); |
4585 | 4585 | echo $text; |
4586 | 4586 | } else { |
4587 | - echo '<pre>' . htmlspecialchars($text, ENT_QUOTES | ENT_HTML5) . '</pre>'; |
|
4587 | + echo '<pre>'.htmlspecialchars($text, ENT_QUOTES | ENT_HTML5).'</pre>'; |
|
4588 | 4588 | } |
4589 | 4589 | exit; |
4590 | 4590 | } |
@@ -4599,9 +4599,9 @@ discard block |
||
4599 | 4599 | $headers_line = ''; |
4600 | 4600 | if (phpthumb_functions::version_compare_replacement(PHP_VERSION, '4.3.0', '>=') |
4601 | 4601 | && headers_sent($headers_file, $headers_line)) { |
4602 | - echo "\n" . '**Headers already sent in file "' . $headers_file . '" on line "' . $headers_line . '", dumping error message as text:**<br><pre>' . "\n\n" . $text . "\n" . '</pre>'; |
|
4602 | + echo "\n".'**Headers already sent in file "'.$headers_file.'" on line "'.$headers_line.'", dumping error message as text:**<br><pre>'."\n\n".$text."\n".'</pre>'; |
|
4603 | 4603 | } elseif (headers_sent()) { |
4604 | - echo "\n" . '**Headers already sent, dumping error message as text:**<br><pre>' . "\n\n" . $text . "\n" . '</pre>'; |
|
4604 | + echo "\n".'**Headers already sent, dumping error message as text:**<br><pre>'."\n\n".$text."\n".'</pre>'; |
|
4605 | 4605 | } elseif ($gdimg_error = imagecreate($width, $height)) { |
4606 | 4606 | $background_color = phpthumb_functions::ImageHexColorAllocate($gdimg_error, $this->config_error_bgcolor, true); |
4607 | 4607 | $text_color = phpthumb_functions::ImageHexColorAllocate($gdimg_error, $this->config_error_textcolor, true); |
@@ -4630,7 +4630,7 @@ discard block |
||
4630 | 4630 | imagedestroy($gdimg_error); |
4631 | 4631 | } |
4632 | 4632 | if (!headers_sent()) { |
4633 | - echo "\n" . '**Failed to send graphical error image, dumping error message as text:**<br>' . "\n\n" . $text; |
|
4633 | + echo "\n".'**Failed to send graphical error image, dumping error message as text:**<br>'."\n\n".$text; |
|
4634 | 4634 | } |
4635 | 4635 | exit; |
4636 | 4636 | } |
@@ -4657,7 +4657,7 @@ discard block |
||
4657 | 4657 | } |
4658 | 4658 | exit; |
4659 | 4659 | } else { |
4660 | - $this->DebugMessage('ImageCreateFromStringReplacement() failed: gd_version says "' . phpthumb_functions::gd_version() . '"', __FILE__, __LINE__); |
|
4660 | + $this->DebugMessage('ImageCreateFromStringReplacement() failed: gd_version says "'.phpthumb_functions::gd_version().'"', __FILE__, __LINE__); |
|
4661 | 4661 | |
4662 | 4662 | return false; |
4663 | 4663 | } |
@@ -4680,11 +4680,11 @@ discard block |
||
4680 | 4680 | case "\xFF\xD8\xFF": |
4681 | 4681 | $ICFSreplacementFunctionName = 'imagecreatefromjpeg'; |
4682 | 4682 | break; |
4683 | - case "\x89" . 'PN': |
|
4683 | + case "\x89".'PN': |
|
4684 | 4684 | $ICFSreplacementFunctionName = 'imagecreatefrompng'; |
4685 | 4685 | break; |
4686 | 4686 | default: |
4687 | - $this->DebugMessage('ImageCreateFromStringReplacement() failed: unknown fileformat signature "' . phpthumb_functions::HexCharDisplay(substr($RawImageData, 0, 3)) . '"', __FILE__, __LINE__); |
|
4687 | + $this->DebugMessage('ImageCreateFromStringReplacement() failed: unknown fileformat signature "'.phpthumb_functions::HexCharDisplay(substr($RawImageData, 0, 3)).'"', __FILE__, __LINE__); |
|
4688 | 4688 | |
4689 | 4689 | return false; |
4690 | 4690 | break; |
@@ -4699,8 +4699,8 @@ discard block |
||
4699 | 4699 | |
4700 | 4700 | // Need to create from GIF file, but imagecreatefromgif does not exist |
4701 | 4701 | ob_start(); |
4702 | - if (!@require_once __DIR__ . '/phpthumb.gif.php') { |
|
4703 | - $ErrorMessage = 'Failed to include required file "' . __DIR__ . '/phpthumb.gif.php" in ' . __FILE__ . ' on line ' . __LINE__; |
|
4702 | + if (!@require_once __DIR__.'/phpthumb.gif.php') { |
|
4703 | + $ErrorMessage = 'Failed to include required file "'.__DIR__.'/phpthumb.gif.php" in '.__FILE__.' on line '.__LINE__; |
|
4704 | 4704 | $this->DebugMessage($ErrorMessage, __FILE__, __LINE__); |
4705 | 4705 | } |
4706 | 4706 | ob_end_clean(); |
@@ -4710,49 +4710,49 @@ discard block |
||
4710 | 4710 | fwrite($fp_tempfile, $RawImageData); |
4711 | 4711 | fclose($fp_tempfile); |
4712 | 4712 | $gdimg_source = gif_loadFileToGDimageResource($tempfilename); |
4713 | - $this->DebugMessage('gif_loadFileToGDimageResource(' . $tempfilename . ') completed', __FILE__, __LINE__); |
|
4714 | - $this->DebugMessage('deleting "' . $tempfilename . '"', __FILE__, __LINE__); |
|
4713 | + $this->DebugMessage('gif_loadFileToGDimageResource('.$tempfilename.') completed', __FILE__, __LINE__); |
|
4714 | + $this->DebugMessage('deleting "'.$tempfilename.'"', __FILE__, __LINE__); |
|
4715 | 4715 | unlink($tempfilename); |
4716 | 4716 | |
4717 | 4717 | return $gdimg_source; |
4718 | 4718 | } else { |
4719 | - $ErrorMessage = 'Failed to open tempfile in ' . __FILE__ . ' on line ' . __LINE__; |
|
4719 | + $ErrorMessage = 'Failed to open tempfile in '.__FILE__.' on line '.__LINE__; |
|
4720 | 4720 | $this->DebugMessage($ErrorMessage, __FILE__, __LINE__); |
4721 | 4721 | } |
4722 | 4722 | } else { |
4723 | - $ErrorMessage = 'Failed to open generate tempfile name in ' . __FILE__ . ' on line ' . __LINE__; |
|
4723 | + $ErrorMessage = 'Failed to open generate tempfile name in '.__FILE__.' on line '.__LINE__; |
|
4724 | 4724 | $this->DebugMessage($ErrorMessage, __FILE__, __LINE__); |
4725 | 4725 | } |
4726 | 4726 | } elseif (function_exists($ICFSreplacementFunctionName) |
4727 | 4727 | && ($gdimg_source = @$ICFSreplacementFunctionName($tempnam))) { |
4728 | 4728 | |
4729 | 4729 | // great |
4730 | - $this->DebugMessage($ICFSreplacementFunctionName . '(' . $tempnam . ') succeeded', __FILE__, __LINE__); |
|
4731 | - $this->DebugMessage('deleting "' . $tempnam . '"', __FILE__, __LINE__); |
|
4730 | + $this->DebugMessage($ICFSreplacementFunctionName.'('.$tempnam.') succeeded', __FILE__, __LINE__); |
|
4731 | + $this->DebugMessage('deleting "'.$tempnam.'"', __FILE__, __LINE__); |
|
4732 | 4732 | unlink($tempnam); |
4733 | 4733 | |
4734 | 4734 | return $gdimg_source; |
4735 | 4735 | } else { |
4736 | 4736 | |
4737 | 4737 | // GD functions not available, or failed to create image |
4738 | - $this->DebugMessage($ICFSreplacementFunctionName . '(' . $tempnam . ') ' . (function_exists($ICFSreplacementFunctionName) ? 'failed' : 'does not exist'), __FILE__, __LINE__); |
|
4738 | + $this->DebugMessage($ICFSreplacementFunctionName.'('.$tempnam.') '.(function_exists($ICFSreplacementFunctionName) ? 'failed' : 'does not exist'), __FILE__, __LINE__); |
|
4739 | 4739 | if (isset($_GET['phpThumbDebug'])) { |
4740 | 4740 | $this->phpThumbDebug(); |
4741 | 4741 | } |
4742 | 4742 | } |
4743 | 4743 | } else { |
4744 | - $ErrorMessage = 'Failed to fopen(' . $tempnam . ', "wb") in ' . __FILE__ . ' on line ' . __LINE__ . "\n" . 'You may need to set $PHPTHUMB_CONFIG[temp_directory] in phpThumb.config.php'; |
|
4744 | + $ErrorMessage = 'Failed to fopen('.$tempnam.', "wb") in '.__FILE__.' on line '.__LINE__."\n".'You may need to set $PHPTHUMB_CONFIG[temp_directory] in phpThumb.config.php'; |
|
4745 | 4745 | if ($this->issafemode) { |
4746 | - $ErrorMessage = 'ImageCreateFromStringReplacement() failed in ' . __FILE__ . ' on line ' . __LINE__ . ': cannot create temp file in SAFE_MODE'; |
|
4746 | + $ErrorMessage = 'ImageCreateFromStringReplacement() failed in '.__FILE__.' on line '.__LINE__.': cannot create temp file in SAFE_MODE'; |
|
4747 | 4747 | } |
4748 | 4748 | $this->DebugMessage($ErrorMessage, __FILE__, __LINE__); |
4749 | 4749 | } |
4750 | - $this->DebugMessage('deleting "' . $tempnam . '"', __FILE__, __LINE__); |
|
4750 | + $this->DebugMessage('deleting "'.$tempnam.'"', __FILE__, __LINE__); |
|
4751 | 4751 | @unlink($tempnam); |
4752 | 4752 | } else { |
4753 | - $ErrorMessage = 'Failed to generate phpThumb_tempnam() in ' . __FILE__ . ' on line ' . __LINE__ . "\n" . 'You may need to set $PHPTHUMB_CONFIG[temp_directory] in phpThumb.config.php'; |
|
4753 | + $ErrorMessage = 'Failed to generate phpThumb_tempnam() in '.__FILE__.' on line '.__LINE__."\n".'You may need to set $PHPTHUMB_CONFIG[temp_directory] in phpThumb.config.php'; |
|
4754 | 4754 | if ($this->issafemode) { |
4755 | - $ErrorMessage = 'ImageCreateFromStringReplacement() failed in ' . __FILE__ . ' on line ' . __LINE__ . ': cannot create temp file in SAFE_MODE'; |
|
4755 | + $ErrorMessage = 'ImageCreateFromStringReplacement() failed in '.__FILE__.' on line '.__LINE__.': cannot create temp file in SAFE_MODE'; |
|
4756 | 4756 | } |
4757 | 4757 | } |
4758 | 4758 | if ($DieOnErrors && $ErrorMessage) { |
@@ -4777,7 +4777,7 @@ discard block |
||
4777 | 4777 | */ |
4778 | 4778 | public function ImageResizeFunction(&$dst_im, &$src_im, $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $srcW, $srcH) |
4779 | 4779 | { |
4780 | - $this->DebugMessage('ImageResizeFunction($o, $s, ' . $dstX . ', ' . $dstY . ', ' . $srcX . ', ' . $srcY . ', ' . $dstW . ', ' . $dstH . ', ' . $srcW . ', ' . $srcH . ')', __FILE__, __LINE__); |
|
4780 | + $this->DebugMessage('ImageResizeFunction($o, $s, '.$dstX.', '.$dstY.', '.$srcX.', '.$srcY.', '.$dstW.', '.$dstH.', '.$srcW.', '.$srcH.')', __FILE__, __LINE__); |
|
4781 | 4781 | if (($dstW == $srcW) && ($dstH == $srcH)) { |
4782 | 4782 | return imagecopy($dst_im, $src_im, $dstX, $dstY, $srcX, $srcY, $srcW, $srcH); |
4783 | 4783 | } |
@@ -4814,7 +4814,7 @@ discard block |
||
4814 | 4814 | $this->InitializeTempDirSetting(); |
4815 | 4815 | $tempnam = $this->realPathSafe(tempnam($this->config_temp_directory, 'pThumb')); |
4816 | 4816 | $this->tempFilesToDelete[$tempnam] = $tempnam; |
4817 | - $this->DebugMessage('phpThumb_tempnam() returning "' . $tempnam . '"', __FILE__, __LINE__); |
|
4817 | + $this->DebugMessage('phpThumb_tempnam() returning "'.$tempnam.'"', __FILE__, __LINE__); |
|
4818 | 4818 | |
4819 | 4819 | return $tempnam; |
4820 | 4820 | } |
@@ -4827,7 +4827,7 @@ discard block |
||
4827 | 4827 | */ |
4828 | 4828 | public function DebugMessage($message, $file = '', $line = '') |
4829 | 4829 | { |
4830 | - $this->debugmessages[] = $message . ($file ? ' in file "' . (basename($file) ?: $file) . '"' : '') . ($line ? ' on line ' . $line : ''); |
|
4830 | + $this->debugmessages[] = $message.($file ? ' in file "'.(basename($file) ?: $file).'"' : '').($line ? ' on line '.$line : ''); |
|
4831 | 4831 | |
4832 | 4832 | return true; |
4833 | 4833 | } |
@@ -4844,7 +4844,7 @@ discard block |
||
4844 | 4844 | if (!$timestamp) { |
4845 | 4845 | $timestamp = array_sum(explode(' ', microtime())); |
4846 | 4846 | } |
4847 | - $this->debugtiming[number_format($timestamp, 6, '.', '')] = ': ' . $message . ($file ? ' in file "' . (basename($file) ?: $file) . '"' : '') . ($line ? ' on line ' . $line : ''); |
|
4847 | + $this->debugtiming[number_format($timestamp, 6, '.', '')] = ': '.$message.($file ? ' in file "'.(basename($file) ?: $file).'"' : '').($line ? ' on line '.$line : ''); |
|
4848 | 4848 | |
4849 | 4849 | return true; |
4850 | 4850 | } |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | $b = $argb['blue']; |
44 | 44 | |
45 | 45 | if (32 == $bpp[$key]) { |
46 | - $icXOR[$key] .= chr($b) . chr($g) . chr($r) . chr($a); |
|
46 | + $icXOR[$key] .= chr($b).chr($g).chr($r).chr($a); |
|
47 | 47 | } elseif (24 == $bpp[$key]) { |
48 | - $icXOR[$key] .= chr($b) . chr($g) . chr($r); |
|
48 | + $icXOR[$key] .= chr($b).chr($g).chr($r); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if ($a < 128) { |
@@ -72,41 +72,41 @@ discard block |
||
72 | 72 | |
73 | 73 | // BITMAPINFOHEADER - 40 bytes |
74 | 74 | $BitmapInfoHeader[$key] = ''; |
75 | - $BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD biSize; |
|
76 | - $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG biWidth; |
|
75 | + $BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD biSize; |
|
76 | + $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG biWidth; |
|
77 | 77 | // The biHeight member specifies the combined |
78 | 78 | // height of the XOR and AND masks. |
79 | 79 | $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageHeights[$key] * 2, 4); // LONG biHeight; |
80 | - $BitmapInfoHeader[$key] .= "\x01\x00"; // WORD biPlanes; |
|
81 | - $BitmapInfoHeader[$key] .= chr($bpp[$key]) . "\x00"; // wBitCount; |
|
82 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biCompression; |
|
83 | - $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD biSizeImage; |
|
84 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biXPelsPerMeter; |
|
85 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biYPelsPerMeter; |
|
86 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrUsed; |
|
87 | - $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrImportant; |
|
80 | + $BitmapInfoHeader[$key] .= "\x01\x00"; // WORD biPlanes; |
|
81 | + $BitmapInfoHeader[$key] .= chr($bpp[$key])."\x00"; // wBitCount; |
|
82 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biCompression; |
|
83 | + $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD biSizeImage; |
|
84 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biXPelsPerMeter; |
|
85 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biYPelsPerMeter; |
|
86 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrUsed; |
|
87 | + $BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrImportant; |
|
88 | 88 | } |
89 | 89 | |
90 | - $icondata = "\x00\x00"; // idReserved; // Reserved (must be 0) |
|
91 | - $icondata .= "\x01\x00"; // idType; // Resource Type (1 for icons) |
|
92 | - $icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount; // How many images? |
|
90 | + $icondata = "\x00\x00"; // idReserved; // Reserved (must be 0) |
|
91 | + $icondata .= "\x01\x00"; // idType; // Resource Type (1 for icons) |
|
92 | + $icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount; // How many images? |
|
93 | 93 | |
94 | 94 | $dwImageOffset = 6 + (count($gd_image_array) * 16); |
95 | 95 | foreach ($gd_image_array as $key => $gd_image) { |
96 | 96 | // ICONDIRENTRY idEntries[1]; // An entry for each image (idCount of 'em) |
97 | 97 | |
98 | - $icondata .= chr($ImageWidths[$key]); // bWidth; // Width, in pixels, of the image |
|
99 | - $icondata .= chr($ImageHeights[$key]); // bHeight; // Height, in pixels, of the image |
|
100 | - $icondata .= chr($totalcolors[$key]); // bColorCount; // Number of colors in image (0 if >=8bpp) |
|
101 | - $icondata .= "\x00"; // bReserved; // Reserved ( must be 0) |
|
98 | + $icondata .= chr($ImageWidths[$key]); // bWidth; // Width, in pixels, of the image |
|
99 | + $icondata .= chr($ImageHeights[$key]); // bHeight; // Height, in pixels, of the image |
|
100 | + $icondata .= chr($totalcolors[$key]); // bColorCount; // Number of colors in image (0 if >=8bpp) |
|
101 | + $icondata .= "\x00"; // bReserved; // Reserved ( must be 0) |
|
102 | 102 | |
103 | - $icondata .= "\x01\x00"; // wPlanes; // Color Planes |
|
104 | - $icondata .= chr($bpp[$key]) . "\x00"; // wBitCount; // Bits per pixel |
|
103 | + $icondata .= "\x01\x00"; // wPlanes; // Color Planes |
|
104 | + $icondata .= chr($bpp[$key])."\x00"; // wBitCount; // Bits per pixel |
|
105 | 105 | |
106 | 106 | $dwBytesInRes = 40 + strlen($icXOR[$key]) + strlen($icAND[$key]); |
107 | - $icondata .= phpthumb_functions::LittleEndian2String($dwBytesInRes, 4); // dwBytesInRes; // How many bytes in this resource? |
|
107 | + $icondata .= phpthumb_functions::LittleEndian2String($dwBytesInRes, 4); // dwBytesInRes; // How many bytes in this resource? |
|
108 | 108 | |
109 | - $icondata .= phpthumb_functions::LittleEndian2String($dwImageOffset, 4); // dwImageOffset; // Where in the file is this image? |
|
109 | + $icondata .= phpthumb_functions::LittleEndian2String($dwImageOffset, 4); // dwImageOffset; // Where in the file is this image? |
|
110 | 110 | $dwImageOffset += strlen($BitmapInfoHeader[$key]); |
111 | 111 | $dwImageOffset += strlen($icXOR[$key]); |
112 | 112 | $dwImageOffset += strlen($icAND[$key]); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | //xoops_loadLanguage('main', $moduleDirName); |
13 | 13 | // Include any common code for this module. |
14 | 14 | |
15 | -require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/common.php'; |
|
15 | +require_once XOOPS_ROOT_PATH.'/modules/'.$moduleDirName.'/include/common.php'; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @todo: move hard coded language strings to language file |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | } |
93 | 93 | } |
94 | 94 | if ('/index.php' === $curpage || '/result.php' === $curpage) { |
95 | - $title = '<b>View/Search ' . $helper->getConfig('animalTypes') . '</b>'; |
|
95 | + $title = '<b>View/Search '.$helper->getConfig('animalTypes').'</b>'; |
|
96 | 96 | } else { |
97 | - $title = 'View/Search ' . $helper->getConfig('animalTypes'); |
|
97 | + $title = 'View/Search '.$helper->getConfig('animalTypes'); |
|
98 | 98 | } |
99 | 99 | $menuarray[] = ['title' => $title, 'link' => 'index.php', 'counter' => $counter]; |
100 | 100 | ++$counter; |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | $counter = 1; |
103 | 103 | } |
104 | 104 | if ('/add_dog.php' === $curpage) { |
105 | - $title = '<b>Add a ' . $helper->getConfig('animalType') . '</b>'; |
|
105 | + $title = '<b>Add a '.$helper->getConfig('animalType').'</b>'; |
|
106 | 106 | } else { |
107 | - $title = 'Add a ' . $helper->getConfig('animalType'); |
|
107 | + $title = 'Add a '.$helper->getConfig('animalType'); |
|
108 | 108 | } |
109 | 109 | $menuarray[] = ['title' => $title, 'link' => 'add_dog.php', 'counter' => $counter]; |
110 | 110 | ++$counter; |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | } |
114 | 114 | if ('1' == $helper->getConfig('uselitter')) { |
115 | 115 | if ('/add_litter.php' === $curpage) { |
116 | - $title = '<b>Add a ' . $helper->getConfig('litter') . '</b>'; |
|
116 | + $title = '<b>Add a '.$helper->getConfig('litter').'</b>'; |
|
117 | 117 | } else { |
118 | - $title = 'Add a ' . $helper->getConfig('litter'); |
|
118 | + $title = 'Add a '.$helper->getConfig('litter'); |
|
119 | 119 | } |
120 | 120 | $menuarray[] = ['title' => $title, 'link' => 'add_litter.php', 'counter' => $counter]; |
121 | 121 | ++$counter; |