$f = trim(filter_input(INPUT_GET, 'f', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));$img = 'components/com_emedia/images/image_not_found.png';if (($f != '') && file_exists(ELXIS_PATH.'/'.$f)) { $ext = strtolower(pathinfo(ELXIS_PATH.'/'.$f, PATHINFO_EXTENSION)); if (in_array($ext, array('png', 'gif', 'jpeg', 'jpg'))) { $img = $f; }}$thumb = eFactory::getElxis()->obj('thumb');$thumb->make($img, 100, 100, true, true);
public function make($image, $width=0, $height=0, $crop=true, $use_cache=true)
eFactory::getFiles()->resizeImage('media/images/test.png', 100, 100, false);
<?php $elxis = eFactory::getElxis();$eFiles = eFactory::getFiles();$large = 'media/images/something.png';$thumb = 'modules/mod_sample/files/something.png';//set image url to the large image (fail over URL, it will be replaced by the thumbnail URL on success)$image = $elxis->secureBase().'/'.$large;if (!file_exists(ELXIS_PATH.'/'.$thumb)) { //thumb does not exist -> create it //copy large image to destination path $ok = $eFiles->copy($large, $thumb); if ($ok) { //copy success //resize it $ok = $eFiles->resizeImage($thumb, 100, 100, true); if ($ok) { //resize success, set image to thumbnail url $image = $elxis->secureBase().'/'.$thumb; } else { //resize failed, delete copied image $eFiles->deleteFile($thumb); } }} else { //thumbnail already exists, set image to thumbnail url $image = $elxis->secureBase().'/'.$thumb;}//display the image thumbnailecho '<img src="'.$image.'" alt="thumbnail" width="100" height="100" />';?>