I did use the same javascript cropper + sfThumbnailPlugin and
Imagemagick.  As you said, I had to implement cropping + resizing in
order to make all that work. I was planning for some time now to
commit those changes to the plugin so I will do that now and let you
take a look at SVN for the changes I have made.

For example, I use it like this:

$coords = array(
    'x1' => $this->getRequestParameter('x1'),
    'x2' => $this->getRequestParameter('x2'),
    'y1' => $this->getRequestParameter('y1'),
    'y2' => $this->getRequestParameter('y2')
);
        
$thumbnail = new sfThumbnail(150, 150, false, true, 75,
'sfImageMagickAdapter', array('method' => 'custom', 'coords' =>
$coords));
$thumbnail->loadFile($original);
$thumbnail->save($thumb, 'image/jpeg');

Valid values for 'method' are: shave_all, shave_bottom, custom.
Shave_all: It will crop the image from all sides until it gets to the
desired proportions and then it will resize it to the final
dimensions.
Shave_bottom: Will do like above but it will not crop the image from
the top which helps with pictures of people so that it does not cut
the head.
Custom: Is exactly what you need for this javascript cropper as the
cropper sends back to your ajax the coordinates of the thumb.

I am committing it out so check it out when you read this email.

Kiril

On Fri, Aug 22, 2008 at 9:49 PM, Tom Haskins-Vaughan
<[EMAIL PROTECTED]> wrote:
>
>  From what I can see, the problem with sfThumbnail for th JS Image
> Cropper is that it only resizes the image rather than cropping and
> resizing. So I had to create a new class that extends the both the
> sfThumbnal class and the gdadaptor class. I did this to make use of all
> the other good parts of the sfThumbnail plugin.
>
> I have everything working, I just wanted to make sure it was as clean as
> possible as I am hoping to include this in many projects to come.
>
> Cédric Sadai wrote:
>> Hi,
>>
>> I did some similar work recently, I noticed a certain number of
>> limitations with sfThumbnailPlugin, for GD at least:
>>
>> - doesn't handle well the difference between portrait and landscape
>> format. If my thumb size is 400*300 and the pic is a portrait, I want
>> it to be automatically set to 300*400.
>> - doesn't handle well the scale option. It scales anyway, even when
>> set to false.
>> - doesn't handle well the squarize option, of course because it's
>> impossible to squarize well if you scale (other words, you HAVE to
>> crop to make a good square).
>>
>> All these things are more complicated than it seems, it's some good
>> math actually. I've rewritten everything, and will certainly propose a
>> plugin/patch out of it, for the GD part.
>>
>> What's your problem exactly?
>> cedric
>>
>> On Aug 21, 2:38 pm, Tom Haskins-Vaughan <[EMAIL PROTECTED]>
>> wrote:
>>> Hi,
>>>
>>> I've just come across this [Prototype JavaScript Image Cropper UI][1].
>>> It's quite cool and by all accounts *seems* to be pretty good across
>>> multiple browsers.
>>>
>>> My questions is: has anyone written any backend stuff to process the
>>> image crop? I've made some (messy) extensions to the sfThumbnail plugin
>>> and got it working fine, but I was wondering if anyone had done a better
>>> job.
>>>
>>> If not, I'll try and package it all into a separate plugin. I'm happy to
>>> do the GD part but I have absolutely no experience of ImageMagik.
>>>
>>> Tom
>>>
>>> [1]http://www.defusion.org.uk/demos/060519/cropper.php
>>> --
>>> Tom Haskins-Vaughan
>>> Temple Street Media: Design and Development for the Web
>>> [EMAIL PROTECTED] |www.templestreetmedia.com
>> >
>>
>
> --
> Tom Haskins-Vaughan
> Temple Street Media: Design and Development for the Web
> [EMAIL PROTECTED] | www.templestreetmedia.com
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to