I use a helper for image manipulation. A simple example would be:
<?php
class ImageHelper extends Helper
{
var $helpers = array('Html');
var $cacheDir = 'imagecache'; // relative to IMAGES_URL path
function link($file)
{
return $this->Html->link($this->Html->image($file, array('border'
=> '0')), '/', null, null, false);
} // End Function
function resize($path, $width, $height, $aspect = true,
$htmlAttributes = array(), $return = false)
{
// Resize logic here
// Return the image
return $this->output(sprintf($this->Html->tags['image'],
$relfile, $this->Html->parseHtmlOptions($htmlAttributes, null, '', '
')), $return);
}
// Add other manipulation functions here
}
?>
In your view, you can do:
<?php echo $image->resize($image, 135, 124, false, array('alt'=>'my
resized image', 'border'=>1, 'hspace'=>4));?>
HTH
-Erich-
Olexandr Melnyk wrote:
> Check out ImageMagick (not CakePHP plugin, but a powerful set of tools)
>
> On 9/9/07, *d'plus* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> Is there any helper/script for cropping and resizing images in
> realtime?
>
>
> I'm trying to adapt this script http://www.ajaxprogrammer.com/?p=9 to
> work with my website, but without success, so I'm trying to find
> something diffrent :(
>
>
>
>
>
> --
> Sincerely yours,
> Olexandr Melnyk
> http://omelnyk.net/
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---