I am creating a cakephp application in which im uploading a image. But on some functionality of my app i want to display the image in specific height n width, without compromissing in image quality. So please suggest me if ther is any way to do this.
You can set only width or height attribute and to leave empty the other one. This way the image will be shown with proper resolution.
But, the performance really depends how big is the image.
Your code will be something like:
$this->Html->image('image1.jpg', array('width'=>'200px'));
I suggest you to use a Plugin and its relatively simple..
http://www.milesj.me/resources/script/uploader-plugin
its very easy to implement. it takes care of validation and also attaching it to the model etc.
Organising the Images
store various sizes in their own folder say u have 200*200, 125*125, 50*50 you can store them in either folders with names with the sizes or like - large, medium, small.
the reason why we are using different folders is. the file name will be the same for all sized versions only folder will change. so it relatively eaiser to be addressed than renaming the files while resizing and cropping.
There are many more plugins out there. here is a good list
http://josediazgonzalez.com/2010/08/16/cakephp-plugins-a-biblical-retelling/
here is a directory for cakephp related resources
http://cakepackages.com/
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With