# Attachment\_fu questions

**URL:** <https://www.ruby-forum.com/t/attachment-fu-questions/112419>\
**Category:** Rails\
**Created:** [August 18, 2007, 5:20pm UTC](https://www.ruby-forum.com/t/attachment-fu-questions/112419 "2007-08-18T17:20:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pabloz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c37758/32.png) [@pabloz](https://www.ruby-forum.com/u/pabloz)\
**Post date:** [August 18, 2007, 5:20pm UTC](https://www.ruby-forum.com/t/attachment-fu-questions/112419/1 "2007-08-18T17:20:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pabloz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c37758/32.png) [@pabloz](https://www.ruby-forum.com/u/pabloz)\
**Post date:** [August 18, 2007, 5:52pm UTC](https://www.ruby-forum.com/t/attachment-fu-questions/112419/2 "2007-08-18T17:52:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pabloz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c37758/32.png) [@pabloz](https://www.ruby-forum.com/u/pabloz)\
**Post date:** [August 18, 2007, 6:10pm UTC](https://www.ruby-forum.com/t/attachment-fu-questions/112419/3 "2007-08-18T18:10:48Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![pabloz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c37758/32.png) [@pabloz](https://www.ruby-forum.com/u/pabloz)\
**Post date:** [August 18, 2007, 8:49pm UTC](https://www.ruby-forum.com/t/attachment-fu-questions/112419/4 "2007-08-18T20:49:50Z")

</div>

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
