Attachment_fu questions

Hello!

I have 2 questions concerning attachment_fu.

  1. Is it possible to validate dimensions of uploaded photo, i want it to
    accept only certain dimensions.

  2. If i create for example :big_picture => ‘800x600’ and :thumb =>
    ‘150x150>’ is it possible to delete the source, big image.

On 18 Aug 2007, at 17:20, Pawel Jur wrote:

  1. Is it possible to validate dimensions of uploaded photo, i want
    it to
    accept only certain dimensions.

Don’t force a user to upload files with certain dimensions, scale the
image yourself (see 2.)

  1. If i create for example :big_picture => ‘800x600’ and :thumb =>
    ‘150x150>’ is it possible to delete the source, big image.

Use :resize_to to resize the main image, this will “delete” the
source image the user uploaded.

Best regards

Peter De Berdt

Thanks for quick reply!

Don’t force a user to upload files with certain dimensions, scale the
image yourself (see 2.)

That’s true. But what if it has to be a specially cropped image, it
can’t be resized automaticlly as far as i know. It’s more for an admin
than for a user but still it would be nice to have this kind of
validation.

  1. If i create for example :big_picture => ‘800x600’ and :thumb =>
    ‘150x150>’ is it possible to delete the source, big image.

Use :resize_to to resize the main image, this will “delete” the
source image the user uploaded.

thanks!

On 18 Aug 2007, at 18:10, Pawel Jur wrote:

Don’t force a user to upload files with certain dimensions, scale the
image yourself (see 2.)

That’s true. But what if it has to be a specially cropped image, it
can’t be resized automaticlly as far as i know. It’s more for an admin
than for a user but still it would be nice to have this kind of
validation.

attachment_fu has callbacks to handle this kind of thing yourself,
you’d have to look them up in the api. You could also use these to do
a scale (so the image fills up the dimensions) and then crop to the
exact size you’re looking for.

Best regards

Peter De Berdt