# Paperclip question

**URL:** <https://www.ruby-forum.com/t/paperclip-question/186331>\
**Category:** Rails\
**Created:** [April 5, 2010, 7:15am UTC](https://www.ruby-forum.com/t/paperclip-question/186331 "2010-04-05T07:15:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 5, 2010, 7:15am UTC](https://www.ruby-forum.com/t/paperclip-question/186331/1 "2010-04-05T07:15:40Z")

</div>

Hi All,

My application is using paperclip and its working fine without any  
problems, I am able to generate the thumb images and big images from  
actual uploaded images. There are many images already uploaded by the  
users. Now I want to create small images from the original uploaded  
image. For the newly uploaded images its working fine but how can I do  
the same for already uploaded image??

if photo.get\_photo(:small).nil?

end

what the code I can write inside or any other way I can do the same??

Thanks,  
Ramu.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 5, 2010, 7:43am UTC](https://www.ruby-forum.com/t/paperclip-question/186331/2 "2010-04-05T07:43:12Z")

</div>

On Apr 4, 2010, at 10:13 PM, removed\_email\_address@domain.invalid wrote:

> if photo.get\_photo(:small).nil?
> 
> end
> 
> what the code I can write inside or any other way I can do the same??
> 
> Thanks,  
> Ramu.

This might get you goingL

```
  File.open(existing_file_name, "rb") {|file|
    self.image = file
  }

```

HTH

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 5, 2010, 9:52am UTC](https://www.ruby-forum.com/t/paperclip-question/186331/3 "2010-04-05T09:52:31Z")

</div>

May be you can try to check url for you thumbnails for example:

# has\_att… :image

if photo.image.blank? or photo.image.url(:small).blank?

# 

end

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 5, 2010, 8:07am UTC](https://www.ruby-forum.com/t/paperclip-question/186331/4 "2010-04-05T08:07:46Z")

</div>

Rake paperclip:reprocess

Sent from my iPhone

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 5, 2010, 9:54am UTC](https://www.ruby-forum.com/t/paperclip-question/186331/5 "2010-04-05T09:54:16Z")

</div>

You can do it by just writing a rake task which takes in the already  
uploaded images one by one  
and then reprocess them and upload them again.  
This will take care of the small and other styles of the images.

Hope this helps.

–Hansraj

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 6, 2010, 11:31am UTC](https://www.ruby-forum.com/t/paperclip-question/186331/6 "2010-04-06T11:31:17Z")

</div>

Thanks all for your suggestions…  
Hansraj, can you please post the code snippet which does that…
