@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc GraphicsMagick image driver class |
|
6 | - * @package KCFinder |
|
7 | - * @version 2.54 |
|
8 | - * @author Pavel Tzonkov <[email protected]> |
|
9 | - * @copyright 2010-2014 KCFinder Project |
|
10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | - * @link http://kcfinder.sunhater.com |
|
13 | - */ |
|
4 | + * |
|
5 | + * @desc GraphicsMagick image driver class |
|
6 | + * @package KCFinder |
|
7 | + * @version 2.54 |
|
8 | + * @author Pavel Tzonkov <[email protected]> |
|
9 | + * @copyright 2010-2014 KCFinder Project |
|
10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | + * @link http://kcfinder.sunhater.com |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class image_gmagick extends image { |
16 | 16 |
@@ -1,17 +1,17 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project. The class are taken from |
4 | - * http://www.php.net/manual/en/function.ziparchive-addemptydir.php |
|
5 | - * |
|
6 | - * @desc Directory to ZIP file archivator |
|
7 | - * @package KCFinder |
|
8 | - * @version 2.54 |
|
9 | - * @author Pavel Tzonkov <[email protected]> |
|
10 | - * @copyright 2010-2014 KCFinder Project |
|
11 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
12 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
13 | - * @link http://kcfinder.sunhater.com |
|
14 | - */ |
|
4 | + * http://www.php.net/manual/en/function.ziparchive-addemptydir.php |
|
5 | + * |
|
6 | + * @desc Directory to ZIP file archivator |
|
7 | + * @package KCFinder |
|
8 | + * @version 2.54 |
|
9 | + * @author Pavel Tzonkov <[email protected]> |
|
10 | + * @copyright 2010-2014 KCFinder Project |
|
11 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
12 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
13 | + * @link http://kcfinder.sunhater.com |
|
14 | + */ |
|
15 | 15 | |
16 | 16 | class zipFolder { |
17 | 17 | protected $zip; |
@@ -1,23 +1,23 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc Browser calling script |
|
6 | - * @package KCFinder |
|
7 | - * @version 2.54 |
|
8 | - * @author Pavel Tzonkov <[email protected]> |
|
9 | - * @copyright 2010-2014 KCFinder Project |
|
10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | - * @link http://kcfinder.sunhater.com |
|
13 | - */ |
|
4 | + * |
|
5 | + * @desc Browser calling script |
|
6 | + * @package KCFinder |
|
7 | + * @version 2.54 |
|
8 | + * @author Pavel Tzonkov <[email protected]> |
|
9 | + * @copyright 2010-2014 KCFinder Project |
|
10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | + * @link http://kcfinder.sunhater.com |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | require "core/autoload.php"; // Init MODX |
16 | 16 | |
17 | 17 | function returnNoPermissionsMessage($role) { |
18 | - global $_lang; |
|
19 | - echo sprintf($_lang['files_management_no_permission'], $role); |
|
20 | - exit; |
|
18 | + global $_lang; |
|
19 | + echo sprintf($_lang['files_management_no_permission'], $role); |
|
20 | + exit; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | if( $_GET['type'] == 'images' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_images')) returnNoPermissionsMessage('assets_images'); |
@@ -166,7 +166,7 @@ |
||
166 | 166 | $resp = _fetch_remote_file( $url, $request_headers ); |
167 | 167 | |
168 | 168 | if (isset($resp) and $resp) { |
169 | - if ($resp->status == '304' ) { |
|
169 | + if ($resp->status == '304' ) { |
|
170 | 170 | // we have the most current copy |
171 | 171 | if ( MAGPIE_DEBUG > 1) { |
172 | 172 | debug("Got 304 for $url"); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | // show debug information |
5 | 5 | if(isset($enable_debug) && $enable_debug==true) { |
6 | - ?> |
|
6 | + ?> |
|
7 | 7 | <script language="javascript"> |
8 | 8 | //document.onload = removeDebug(); |
9 | 9 | |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | } |
34 | 34 | </style> |
35 | 35 | <?php |
36 | - $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
37 | - ?> |
|
36 | + $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
37 | + ?> |
|
38 | 38 | <div class='debug' id='debug' name='debug' onClick="removeDebugDiv();"> |
39 | 39 | <table border="0" cellspacing="0" cellpadding="0"> |
40 | 40 | <tr> |
@@ -19,60 +19,60 @@ |
||
19 | 19 | </head><body> |
20 | 20 | "; |
21 | 21 | if($is_error) { |
22 | - $parsedMessageString .= "<h3 style='color:red;background:#e0e0e0;padding:2px;'> MODX Parse Error </h3> |
|
22 | + $parsedMessageString .= "<h3 style='color:red;background:#e0e0e0;padding:2px;'> MODX Parse Error </h3> |
|
23 | 23 | <table border='0' cellpadding='1' cellspacing='0'> |
24 | 24 | <tr><td colspan='3'>MODX encountered the following error while attempting to parse the requested resource:</td></tr> |
25 | 25 | <tr><td colspan='3'><b style='color:red;'>« $msg »</b></td></tr>"; |
26 | 26 | } else { |
27 | - $parsedMessageString .= "<h3 style='color:#003399; background:#eeeeee;padding:2px;'> MODX Debug/ stop message </h3> |
|
27 | + $parsedMessageString .= "<h3 style='color:#003399; background:#eeeeee;padding:2px;'> MODX Debug/ stop message </h3> |
|
28 | 28 | <table border='0' cellpadding='1' cellspacing='0'> |
29 | 29 | <tr><td colspan='3'>The MODX parser recieved the following debug/ stop message:</td></tr> |
30 | 30 | <tr><td colspan='3'><b style='color:#003399;'>« $msg »</b></td></tr>"; |
31 | 31 | } |
32 | 32 | |
33 | 33 | if(!empty($query)) { |
34 | - $parsedMessageString .= "<tr><td colspan='3'><hr size='1' width='98%' style='color:#e0e0e0'/><b style='color:#999;font-size: 9px;border-left:1px solid #c0c0c0; margin-left:10px;'> SQL: <span id='sqlHolder'>$query</span></b><hr size='1' width='98%' style='color:#e0e0e0'/> |
|
34 | + $parsedMessageString .= "<tr><td colspan='3'><hr size='1' width='98%' style='color:#e0e0e0'/><b style='color:#999;font-size: 9px;border-left:1px solid #c0c0c0; margin-left:10px;'> SQL: <span id='sqlHolder'>$query</span></b><hr size='1' width='98%' style='color:#e0e0e0'/> |
|
35 | 35 | <a href='javascript:copyToClip();' style='color:#821517;font-size: 9px; text-decoration: none'>[Copy SQL to ClipBoard]</a><textarea id='holdtext' style='display:none;'></textarea></td></tr>"; |
36 | 36 | } |
37 | 37 | |
38 | 38 | if($text!='') { |
39 | 39 | |
40 | - $errortype = array ( |
|
41 | - E_ERROR => "Error", |
|
42 | - E_WARNING => "Warning", |
|
43 | - E_PARSE => "Parsing Error", |
|
44 | - E_NOTICE => "Notice", |
|
45 | - E_CORE_ERROR => "Core Error", |
|
46 | - E_CORE_WARNING => "Core Warning", |
|
47 | - E_COMPILE_ERROR => "Compile Error", |
|
48 | - E_COMPILE_WARNING => "Compile Warning", |
|
49 | - E_USER_ERROR => "User Error", |
|
50 | - E_USER_WARNING => "User Warning", |
|
51 | - E_USER_NOTICE => "User Notice", |
|
52 | - ); |
|
40 | + $errortype = array ( |
|
41 | + E_ERROR => "Error", |
|
42 | + E_WARNING => "Warning", |
|
43 | + E_PARSE => "Parsing Error", |
|
44 | + E_NOTICE => "Notice", |
|
45 | + E_CORE_ERROR => "Core Error", |
|
46 | + E_CORE_WARNING => "Core Warning", |
|
47 | + E_COMPILE_ERROR => "Compile Error", |
|
48 | + E_COMPILE_WARNING => "Compile Warning", |
|
49 | + E_USER_ERROR => "User Error", |
|
50 | + E_USER_WARNING => "User Warning", |
|
51 | + E_USER_NOTICE => "User Notice", |
|
52 | + ); |
|
53 | 53 | |
54 | - $parsedMessageString .= "<tr><td> </td></tr><tr><td colspan='3'><b>PHP error debug</b></td></tr>"; |
|
54 | + $parsedMessageString .= "<tr><td> </td></tr><tr><td colspan='3'><b>PHP error debug</b></td></tr>"; |
|
55 | 55 | |
56 | - $parsedMessageString .= "<tr><td valign='top'> Error: </td>"; |
|
57 | - $parsedMessageString .= "<td colspan='2'>$text</td><td> </td>"; |
|
58 | - $parsedMessageString .= "</tr>"; |
|
56 | + $parsedMessageString .= "<tr><td valign='top'> Error: </td>"; |
|
57 | + $parsedMessageString .= "<td colspan='2'>$text</td><td> </td>"; |
|
58 | + $parsedMessageString .= "</tr>"; |
|
59 | 59 | |
60 | - $parsedMessageString .= "<tr><td valign='top'> Error type/ Nr.: </td>"; |
|
61 | - $parsedMessageString .= "<td colspan='2'>".$errortype[$nr]." - $nr</b></td><td> </td>"; |
|
62 | - $parsedMessageString .= "</tr>"; |
|
60 | + $parsedMessageString .= "<tr><td valign='top'> Error type/ Nr.: </td>"; |
|
61 | + $parsedMessageString .= "<td colspan='2'>".$errortype[$nr]." - $nr</b></td><td> </td>"; |
|
62 | + $parsedMessageString .= "</tr>"; |
|
63 | 63 | |
64 | - $parsedMessageString .= "<tr><td> File: </td>"; |
|
65 | - $parsedMessageString .= "<td colspan='2'>$file</td><td> </td>"; |
|
66 | - $parsedMessageString .= "</tr>"; |
|
64 | + $parsedMessageString .= "<tr><td> File: </td>"; |
|
65 | + $parsedMessageString .= "<td colspan='2'>$file</td><td> </td>"; |
|
66 | + $parsedMessageString .= "</tr>"; |
|
67 | 67 | |
68 | - $parsedMessageString .= "<tr><td> Line: </td>"; |
|
69 | - $parsedMessageString .= "<td colspan='2'>$line</td><td> </td>"; |
|
70 | - $parsedMessageString .= "</tr>"; |
|
71 | - if($source!='') { |
|
72 | - $parsedMessageString .= "<tr><td valign='top'> Line $line source: </td>"; |
|
73 | - $parsedMessageString .= "<td colspan='2'>$source</td><td> </td>"; |
|
74 | - $parsedMessageString .= "</tr>"; |
|
75 | - } |
|
68 | + $parsedMessageString .= "<tr><td> Line: </td>"; |
|
69 | + $parsedMessageString .= "<td colspan='2'>$line</td><td> </td>"; |
|
70 | + $parsedMessageString .= "</tr>"; |
|
71 | + if($source!='') { |
|
72 | + $parsedMessageString .= "<tr><td valign='top'> Line $line source: </td>"; |
|
73 | + $parsedMessageString .= "<td colspan='2'>$source</td><td> </td>"; |
|
74 | + $parsedMessageString .= "</tr>"; |
|
75 | + } |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $parsedMessageString .= "<tr><td> </td></tr><tr><td colspan='3'><b>Parser timing</b></td></tr>"; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | // load template |
24 | 24 | if(!isset($modx->config['manager_lockout_tpl']) || empty($modx->config['manager_lockout_tpl'])) { |
25 | - $modx->config['manager_lockout_tpl'] = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
|
25 | + $modx->config['manager_lockout_tpl'] = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $target = $modx->config['manager_lockout_tpl']; |
@@ -30,40 +30,40 @@ discard block |
||
30 | 30 | $target = $modx->mergeSettingsContent($target); |
31 | 31 | |
32 | 32 | if(substr($target,0,1)==='@') { |
33 | - if(substr($target,0,6)==='@CHUNK') { |
|
34 | - $target = trim(substr($target,7)); |
|
35 | - $lockout_tpl = $modx->getChunk($target); |
|
36 | - } |
|
37 | - elseif(substr($target,0,5)==='@FILE') { |
|
38 | - $target = trim(substr($target,6)); |
|
39 | - $lockout_tpl = file_get_contents($target); |
|
40 | - } |
|
41 | - } else { |
|
42 | - $chunk = $modx->getChunk($target); |
|
43 | - if($chunk!==false && !empty($chunk)) { |
|
44 | - $lockout_tpl = $chunk; |
|
45 | - } |
|
46 | - elseif(is_file(MODX_BASE_PATH . $target)) { |
|
47 | - $target = MODX_BASE_PATH . $target; |
|
48 | - $lockout_tpl = file_get_contents($target); |
|
49 | - } |
|
50 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl')) { |
|
51 | - $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl'; |
|
52 | - $lockout_tpl = file_get_contents($target); |
|
53 | - } |
|
54 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl')) { |
|
55 | - $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl'; |
|
56 | - $login_tpl = file_get_contents($target); |
|
57 | - } |
|
58 | - elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html')) { // ClipperCMS compatible |
|
59 | - $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html'; |
|
60 | - $lockout_tpl = file_get_contents($target); |
|
61 | - } |
|
62 | - else { |
|
63 | - $target = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
|
64 | - $lockout_tpl = file_get_contents($target); |
|
65 | - } |
|
66 | - } |
|
33 | + if(substr($target,0,6)==='@CHUNK') { |
|
34 | + $target = trim(substr($target,7)); |
|
35 | + $lockout_tpl = $modx->getChunk($target); |
|
36 | + } |
|
37 | + elseif(substr($target,0,5)==='@FILE') { |
|
38 | + $target = trim(substr($target,6)); |
|
39 | + $lockout_tpl = file_get_contents($target); |
|
40 | + } |
|
41 | + } else { |
|
42 | + $chunk = $modx->getChunk($target); |
|
43 | + if($chunk!==false && !empty($chunk)) { |
|
44 | + $lockout_tpl = $chunk; |
|
45 | + } |
|
46 | + elseif(is_file(MODX_BASE_PATH . $target)) { |
|
47 | + $target = MODX_BASE_PATH . $target; |
|
48 | + $lockout_tpl = file_get_contents($target); |
|
49 | + } |
|
50 | + elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl')) { |
|
51 | + $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl'; |
|
52 | + $lockout_tpl = file_get_contents($target); |
|
53 | + } |
|
54 | + elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl')) { |
|
55 | + $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl'; |
|
56 | + $login_tpl = file_get_contents($target); |
|
57 | + } |
|
58 | + elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html')) { // ClipperCMS compatible |
|
59 | + $target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html'; |
|
60 | + $lockout_tpl = file_get_contents($target); |
|
61 | + } |
|
62 | + else { |
|
63 | + $target = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl'; |
|
64 | + $lockout_tpl = file_get_contents($target); |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | 68 | // merge placeholders |
69 | 69 | $lockout_tpl = $modx->mergePlaceholderContent($lockout_tpl); |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | if ($filesize = filesize($cache_file) ) { |
97 | - $data = fread( $fp, filesize($cache_file) ); |
|
98 | - $rss = $this->unserialize( $data ); |
|
97 | + $data = fread( $fp, filesize($cache_file) ); |
|
98 | + $rss = $this->unserialize( $data ); |
|
99 | 99 | |
100 | - return $rss; |
|
101 | - } |
|
100 | + return $rss; |
|
101 | + } |
|
102 | 102 | |
103 | - return 0; |
|
103 | + return 0; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /*=======================================================================*\ |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - function cache_age( $cache_key ) { |
|
138 | - $filename = $this->file_name( $url ); |
|
139 | - if ( file_exists( $filename ) ) { |
|
140 | - $mtime = filemtime( $filename ); |
|
137 | + function cache_age( $cache_key ) { |
|
138 | + $filename = $this->file_name( $url ); |
|
139 | + if ( file_exists( $filename ) ) { |
|
140 | + $mtime = filemtime( $filename ); |
|
141 | 141 | $age = time() - $mtime; |
142 | - return $age; |
|
143 | - } |
|
144 | - else { |
|
145 | - return -1; |
|
146 | - } |
|
147 | - } |
|
142 | + return $age; |
|
143 | + } |
|
144 | + else { |
|
145 | + return -1; |
|
146 | + } |
|
147 | + } |
|
148 | 148 | |
149 | 149 | /*=======================================================================*\ |
150 | 150 | Function: serialize |
@@ -1,44 +1,44 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc GD extension class |
|
6 | - * @package KCFinder |
|
7 | - * @version 2.51 |
|
8 | - * @author Pavel Tzonkov <[email protected]> |
|
9 | - * @copyright 2010, 2011 KCFinder Project |
|
10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | - * @link http://kcfinder.sunhater.com |
|
13 | - */ |
|
4 | + * |
|
5 | + * @desc GD extension class |
|
6 | + * @package KCFinder |
|
7 | + * @version 2.51 |
|
8 | + * @author Pavel Tzonkov <[email protected]> |
|
9 | + * @copyright 2010, 2011 KCFinder Project |
|
10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | + * @link http://kcfinder.sunhater.com |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class gd { |
16 | 16 | |
17 | - /** GD resource |
|
18 | - * @var resource */ |
|
17 | + /** GD resource |
|
18 | + * @var resource */ |
|
19 | 19 | protected $image; |
20 | 20 | |
21 | - /** Image width |
|
22 | - * @var integer */ |
|
21 | + /** Image width |
|
22 | + * @var integer */ |
|
23 | 23 | protected $width; |
24 | 24 | |
25 | - /** Image height |
|
26 | - * @var integer */ |
|
25 | + /** Image height |
|
26 | + * @var integer */ |
|
27 | 27 | protected $height; |
28 | 28 | |
29 | - /** Init error |
|
30 | - * @var bool */ |
|
29 | + /** Init error |
|
30 | + * @var bool */ |
|
31 | 31 | public $init_error = false; |
32 | 32 | |
33 | - /** Last builded image type constant (IMAGETYPE_XXX) |
|
34 | - * @var integer */ |
|
33 | + /** Last builded image type constant (IMAGETYPE_XXX) |
|
34 | + * @var integer */ |
|
35 | 35 | public $type; |
36 | 36 | |
37 | - /** Returns an array. Element 0 - GD resource. Element 1 - width. Element 2 - height. |
|
38 | - * Returns FALSE on failure. The only one parameter $image can be an instance of this class, |
|
39 | - * a GD resource, an array(width, height) or path to image file. |
|
40 | - * @param mixed $image |
|
41 | - * @return array */ |
|
37 | + /** Returns an array. Element 0 - GD resource. Element 1 - width. Element 2 - height. |
|
38 | + * Returns FALSE on failure. The only one parameter $image can be an instance of this class, |
|
39 | + * a GD resource, an array(width, height) or path to image file. |
|
40 | + * @param mixed $image |
|
41 | + * @return array */ |
|
42 | 42 | |
43 | 43 | protected function build_image($image) { |
44 | 44 | |
@@ -87,16 +87,16 @@ discard block |
||
87 | 87 | return $return; |
88 | 88 | } |
89 | 89 | |
90 | - /** Parameter $image can be: |
|
91 | - * 1. An instance of this class (copy instance). |
|
92 | - * 2. A GD resource. |
|
93 | - * 3. An array with two elements. First - width, second - height. Create a blank image. |
|
94 | - * 4. A filename string. Get image form file. |
|
95 | - * The non-required parameter $bigger_size is the bigger dimension (width or height) the image |
|
96 | - * will be resized to. The other dimension (height or width) will be calculated autamaticaly |
|
97 | - * @param mixed $image |
|
98 | - * @param integer $bigger_size |
|
99 | - * @return gd */ |
|
90 | + /** Parameter $image can be: |
|
91 | + * 1. An instance of this class (copy instance). |
|
92 | + * 2. A GD resource. |
|
93 | + * 3. An array with two elements. First - width, second - height. Create a blank image. |
|
94 | + * 4. A filename string. Get image form file. |
|
95 | + * The non-required parameter $bigger_size is the bigger dimension (width or height) the image |
|
96 | + * will be resized to. The other dimension (height or width) will be calculated autamaticaly |
|
97 | + * @param mixed $image |
|
98 | + * @param integer $bigger_size |
|
99 | + * @return gd */ |
|
100 | 100 | |
101 | 101 | public function __construct($image, $bigger_size=null) { |
102 | 102 | $this->image = $this->width = $this->height = null; |
@@ -123,30 +123,30 @@ discard block |
||
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - /** Returns the GD resource |
|
127 | - * @return resource */ |
|
126 | + /** Returns the GD resource |
|
127 | + * @return resource */ |
|
128 | 128 | |
129 | 129 | public function get_image() { |
130 | 130 | return $this->image; |
131 | 131 | } |
132 | 132 | |
133 | - /** Returns the image width |
|
134 | - * @return integer */ |
|
133 | + /** Returns the image width |
|
134 | + * @return integer */ |
|
135 | 135 | |
136 | 136 | public function get_width() { |
137 | 137 | return $this->width; |
138 | 138 | } |
139 | 139 | |
140 | - /** Returns the image height |
|
141 | - * @return integer */ |
|
140 | + /** Returns the image height |
|
141 | + * @return integer */ |
|
142 | 142 | |
143 | 143 | public function get_height() { |
144 | 144 | return $this->height; |
145 | 145 | } |
146 | 146 | |
147 | - /** Returns calculated proportional width from the given height |
|
148 | - * @param integer $resized_height |
|
149 | - * @return integer */ |
|
147 | + /** Returns calculated proportional width from the given height |
|
148 | + * @param integer $resized_height |
|
149 | + * @return integer */ |
|
150 | 150 | |
151 | 151 | public function get_prop_width($resized_height) { |
152 | 152 | $width = intval(($this->width * $resized_height) / $this->height); |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | return $width; |
155 | 155 | } |
156 | 156 | |
157 | - /** Returns calculated proportional height from the given width |
|
158 | - * @param integer $resized_width |
|
159 | - * @return integer */ |
|
157 | + /** Returns calculated proportional height from the given width |
|
158 | + * @param integer $resized_width |
|
159 | + * @return integer */ |
|
160 | 160 | |
161 | 161 | public function get_prop_height($resized_width) { |
162 | 162 | $height = intval(($this->height * $resized_width) / $this->width); |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | return $height; |
165 | 165 | } |
166 | 166 | |
167 | - /** Returns an array with calculated proportional width & height. |
|
168 | - * The parameter $bigger_size is the bigger dimension (width or height) of calculated sizes. |
|
169 | - * The other dimension (height or width) will be calculated autamaticaly |
|
170 | - * @param integer $bigger_size |
|
171 | - * @return array */ |
|
167 | + /** Returns an array with calculated proportional width & height. |
|
168 | + * The parameter $bigger_size is the bigger dimension (width or height) of calculated sizes. |
|
169 | + * The other dimension (height or width) will be calculated autamaticaly |
|
170 | + * @param integer $bigger_size |
|
171 | + * @return array */ |
|
172 | 172 | |
173 | 173 | public function get_prop_size($bigger_size) { |
174 | 174 | |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | return array($width, $height); |
187 | 187 | } |
188 | 188 | |
189 | - /** Resize image. Returns TRUE on success or FALSE on failure |
|
190 | - * @param integer $width |
|
191 | - * @param integer $height |
|
192 | - * @return bool */ |
|
189 | + /** Resize image. Returns TRUE on success or FALSE on failure |
|
190 | + * @param integer $width |
|
191 | + * @param integer $height |
|
192 | + * @return bool */ |
|
193 | 193 | |
194 | 194 | public function resize($width, $height) { |
195 | 195 | if (!$width) $width = 1; |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | ); |
204 | 204 | } |
205 | 205 | |
206 | - /** Resize the given image source (GD, gd object or image file path) to fit in the own image. |
|
207 | - * The outside ares will be cropped out. Returns TRUE on success or FALSE on failure |
|
208 | - * @param mixed $src |
|
209 | - * @return bool */ |
|
206 | + /** Resize the given image source (GD, gd object or image file path) to fit in the own image. |
|
207 | + * The outside ares will be cropped out. Returns TRUE on success or FALSE on failure |
|
208 | + * @param mixed $src |
|
209 | + * @return bool */ |
|
210 | 210 | |
211 | 211 | public function resize_crop($src) { |
212 | 212 | $image_details = $this->build_image($src); |
@@ -233,10 +233,10 @@ discard block |
||
233 | 233 | return false; |
234 | 234 | } |
235 | 235 | |
236 | - /** Resize image to fit in given resolution. Returns TRUE on success or FALSE on failure |
|
237 | - * @param integer $width |
|
238 | - * @param integer $height |
|
239 | - * @return bool */ |
|
236 | + /** Resize image to fit in given resolution. Returns TRUE on success or FALSE on failure |
|
237 | + * @param integer $width |
|
238 | + * @param integer $height |
|
239 | + * @return bool */ |
|
240 | 240 | |
241 | 241 | public function resize_fit($width, $height) { |
242 | 242 | if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) |
@@ -250,12 +250,12 @@ discard block |
||
250 | 250 | return $this->resize($width, $height); |
251 | 251 | } |
252 | 252 | |
253 | - /** Neka si predstavim vyobrazhaem pravoygylnik s razmeri $width i $height. |
|
254 | - * Izobrazhenieto shte se preorazmeri taka che to shte izliza ot tozi pravoygylnik, |
|
255 | - * no samo po edno (x ili y) izmerenie |
|
256 | - * @param integer $width |
|
257 | - * @param integer $height |
|
258 | - * @return bool */ |
|
253 | + /** Neka si predstavim vyobrazhaem pravoygylnik s razmeri $width i $height. |
|
254 | + * Izobrazhenieto shte se preorazmeri taka che to shte izliza ot tozi pravoygylnik, |
|
255 | + * no samo po edno (x ili y) izmerenie |
|
256 | + * @param integer $width |
|
257 | + * @param integer $height |
|
258 | + * @return bool */ |
|
259 | 259 | |
260 | 260 | public function resize_overflow($width, $height) { |
261 | 261 | |
@@ -368,30 +368,30 @@ discard block |
||
368 | 368 | |
369 | 369 | |
370 | 370 | |
371 | - /*** gif transparent fix - 1.10.2013 ***/ |
|
371 | + /*** gif transparent fix - 1.10.2013 ***/ |
|
372 | 372 | |
373 | - $transindex = imagecolortransparent($src); |
|
374 | - $palletsize = imagecolorstotal($src); |
|
375 | - if($transindex >= 0 && $transindex < $palletsize) { |
|
376 | - $transcol = imagecolorsforindex($src, $transindex); |
|
373 | + $transindex = imagecolortransparent($src); |
|
374 | + $palletsize = imagecolorstotal($src); |
|
375 | + if($transindex >= 0 && $transindex < $palletsize) { |
|
376 | + $transcol = imagecolorsforindex($src, $transindex); |
|
377 | 377 | |
378 | - /*** end gif transparent fix ***/ |
|
378 | + /*** end gif transparent fix ***/ |
|
379 | 379 | |
380 | - $transindex = imagecolorallocatealpha($this->image, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
381 | - imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transindex); |
|
382 | - imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
|
383 | - imagecolortransparent($this->image, $transindex); |
|
384 | - for($y=0; $y<$dst_h; ++$y) |
|
385 | - for($x=0; $x<$dst_w; ++$x) |
|
386 | - if(((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) imagesetpixel($this->image, $x, $y, $transindex); |
|
387 | - imagetruecolortopalette($this->image, true, 255); |
|
388 | - } |
|
389 | - else { |
|
390 | - $transparent = imagecolorallocatealpha($this->image, 255, 255, 255, 127); |
|
391 | - imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transparent); |
|
392 | - imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
|
393 | - } |
|
394 | - return $this->image; |
|
380 | + $transindex = imagecolorallocatealpha($this->image, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
381 | + imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transindex); |
|
382 | + imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
|
383 | + imagecolortransparent($this->image, $transindex); |
|
384 | + for($y=0; $y<$dst_h; ++$y) |
|
385 | + for($x=0; $x<$dst_w; ++$x) |
|
386 | + if(((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) imagesetpixel($this->image, $x, $y, $transindex); |
|
387 | + imagetruecolortopalette($this->image, true, 255); |
|
388 | + } |
|
389 | + else { |
|
390 | + $transparent = imagecolorallocatealpha($this->image, 255, 255, 255, 127); |
|
391 | + imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transparent); |
|
392 | + imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
|
393 | + } |
|
394 | + return $this->image; |
|
395 | 395 | |
396 | 396 | } else |
397 | 397 | return false; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | public function imagegif($filename=null) { |
420 | 420 | if (is_null($filename) && !headers_sent()) |
421 | 421 | header("Content-Type: image/gif"); |
422 | - @imagesavealpha($this->image, true); |
|
422 | + @imagesavealpha($this->image, true); |
|
423 | 423 | return imagegif($this->image, $filename); |
424 | 424 | } |
425 | 425 | } |