/ Published in: PHP
makes a resized duplicate of an image
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
example: $imgId = $_FILES['article_image']['name']; //make thumbnail $this->ImageManager->makeImage(WWW_ROOT.'/img/articleImages/'.$imgId, WWW_ROOT.'/img/articleThumbs/'.$imgId, 85, 110); <?php class ImageManagerComponent extends Object { var $controller; function makeImage($input, $output, $max_width, $max_height) { $ratio = ($orig_height>$orig_width) ? $max_width/$orig_width : $max_height/$orig_height; $new_width = $orig_width * $ratio; $new_height = $orig_height * $ratio; } function delete($fileName) { { return true; } else { return false; } } } ?>