@@ 1198-1232 (lines=35) @@ | ||
1195 | * @param string $fit Resize mode (see the wideImage library for more information) |
|
1196 | * @return bool |
|
1197 | */ |
|
1198 | public function resizePicture( |
|
1199 | $src_path, |
|
1200 | $dst_path, |
|
1201 | $param_width, |
|
1202 | $param_height, |
|
1203 | $keep_original = false, |
|
1204 | $fit = 'inside') |
|
1205 | { |
|
1206 | // require_once OLEDRION_PATH . 'class/wideimage/WideImage.inc.php'; |
|
1207 | $resize = true; |
|
1208 | if (OLEDRION_DONT_RESIZE_IF_SMALLER) { |
|
1209 | $pictureDimensions = getimagesize($src_path); |
|
1210 | if (is_array($pictureDimensions)) { |
|
1211 | $width = $pictureDimensions[0]; |
|
1212 | $height = $pictureDimensions[1]; |
|
1213 | if ($width < $param_width && $height < $param_height) { |
|
1214 | $resize = false; |
|
1215 | } |
|
1216 | } |
|
1217 | } |
|
1218 | ||
1219 | $img = WideImage::load($src_path); |
|
1220 | if ($resize) { |
|
1221 | $result = $img->resize($param_width, $param_height, $fit); |
|
1222 | $result->saveToFile($dst_path); |
|
1223 | } else { |
|
1224 | @copy($src_path, $dst_path); |
|
1225 | } |
|
1226 | ||
1227 | if (!$keep_original) { |
|
1228 | @unlink($src_path); |
|
1229 | } |
|
1230 | ||
1231 | return true; |
|
1232 | } |
|
1233 | ||
1234 | /** |
|
1235 | * Déclenchement d'une alerte Xoops suite à un évènement |
@@ 1341-1375 (lines=35) @@ | ||
1338 | * @param string $fit Resize mode (see the wideImage library for more information) |
|
1339 | * @return bool |
|
1340 | */ |
|
1341 | public static function resizePicture( |
|
1342 | $src_path, |
|
1343 | $dst_path, |
|
1344 | $param_width, |
|
1345 | $param_height, |
|
1346 | $keep_original = false, |
|
1347 | $fit = 'inside') |
|
1348 | { |
|
1349 | // require_once OLEDRION_PATH . 'class/wideimage/WideImage.inc.php'; |
|
1350 | $resize = true; |
|
1351 | if (OLEDRION_DONT_RESIZE_IF_SMALLER) { |
|
1352 | $pictureDimensions = getimagesize($src_path); |
|
1353 | if (is_array($pictureDimensions)) { |
|
1354 | $width = $pictureDimensions[0]; |
|
1355 | $height = $pictureDimensions[1]; |
|
1356 | if ($width < $param_width && $height < $param_height) { |
|
1357 | $resize = false; |
|
1358 | } |
|
1359 | } |
|
1360 | } |
|
1361 | ||
1362 | $img = WideImage::load($src_path); |
|
1363 | if ($resize) { |
|
1364 | $result = $img->resize($param_width, $param_height, $fit); |
|
1365 | $result->saveToFile($dst_path); |
|
1366 | } else { |
|
1367 | @copy($src_path, $dst_path); |
|
1368 | } |
|
1369 | ||
1370 | if (!$keep_original) { |
|
1371 | @unlink($src_path); |
|
1372 | } |
|
1373 | ||
1374 | return true; |
|
1375 | } |
|
1376 | ||
1377 | /** |
|
1378 | * Déclenchement d'une alerte Xoops suite à un évènement |