image resize with aspect ratio in CakePHP Installation Place the above script in a file named ImgResizerComponent.php within your app/controllers/components/ directory. Next, simply add ‘ ImgResizer‘ to your controller’s component property. ImgResizer Component Download Link Example $image = WWW_ROOT . ’img/myimage.png’; $w=100; $h=100; $this->ImgResizer->set_image($w,$h,$image );