Lukas Kahwe Smith wrote:
> Fabien POTENCIER wrote:
>   
>> Just need someone to release it. I've just done it.
>>
>> Fabien
>>
>> Lukas Kahwe Smith wrote:
>>     
>>> Hi,
>>>
>>> I would like to use the toString() method added to trunk. Any ETA for a 
>>> release or any reason not to release today? :)
>>>       
>
> One more feature I would like to see in this plugin (maybe its already 
> there and I dont know how to trigger it) would be the ability to cut off 
> part of the image instead of scaling in order to force a specific width 
> and height.
>
> So if I have an image width 120 and height 160 and I want to scale it to 
> 24x24, it would first cut of 20 pixel form the top and bottom, to get 
> the final proportions and then it would reduce the size to 20x20.
>
> regards,
> Lukas
>
> >
>
>   
Lukas,

I just spent some time to port my thumbnail class to sfThumbnailPlugin 
and added the functionality you want. I did not use the plugin just 
because of that and also that I did not see that I can use ImageMagick 
rather than GD (I thought it only used GD). But now when I took a look I 
saw that I can easily port the things I wrote around imagemagick's 
convert command and extend sfThumbnail.

So here is the deal. The things I had special in my class were 3.

1) I can use a URL for the source image.
2) I can 'shave' the original image in order to get the desired 
thumbnail size.
3) I can crop the original image so that the bottom part is shaved in 
order to reach the needed thumbnail size. If the image is wider than 
taller, then I shave from both left side and right side until the 
desired thumbnail size.

[php]
//$thumbnail = new sfThumbnail(150, 150, false, true, 75, 
'sfImageMagickAdapter', array('method' => 'shave_all'));
$thumbnail = new sfThumbnail(150, 150, false, true, 75, 
'sfImageMagickAdapter', array('method' => 'shave_bottom'));

$thumbnail->loadFile('http://www.walkerbooks.co.uk/assets_walker/dynamic/1172005677146.png');
$thumbnail->save('/tmp/shave.png', 'image/png');
[/php]


Fabien, please look at my changes and tell me if there is a reason not 
to be included in the plugin. I think this is necessity for anybody who 
is creating thumbnails in their website, simple resize just does not cut it.

Thanks and hope it helps somebody,
Kiril

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" 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/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Attachment: sfThumbnailPlugin.tar.gz
Description: GNU Zip compressed data

Reply via email to