# Batch-process images in a Rails App

**URL:** <https://www.ruby-forum.com/t/batch-process-images-in-a-rails-app/117943>\
**Category:** Rails\
**Created:** [October 22, 2007, 6:00pm UTC](https://www.ruby-forum.com/t/batch-process-images-in-a-rails-app/117943 "2007-10-22T18:00:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [October 22, 2007, 6:00pm UTC](https://www.ruby-forum.com/t/batch-process-images-in-a-rails-app/117943/1 "2007-10-22T18:00:40Z")

</div>

Hello list,

I’m building a gallery website in Rails and I’d like to batch-add  
pictures  
to a gallery. I’ve developed a similar application in PHP before and  
I’ve  
found two ways to do that:

- Archive the images in a zip file and upload them through a web form;
- Set up a FTP account for a directory in which image files for the  
next  
to-be registered gallery will be placed. In the moment the admin  
registers  
the new gallery, the script will look into this directory to get the  
images

Once the images are collected, the script would then create a non-public  
folder with the name of the gallery and with three subdirs: /hires,  
/normal,  
/thumb. The hi-res images go into hires, then these same images are  
processed by imagemagick and re-dimensioned into a lower-resolution  
“normal”  
image to be shown in the website. The same process happens for the  
thumbs.

The images shouldn’t be directly accessible by the webserver, they  
should be  
served by a rails script (controller?) since the hi-res ones will  
require  
additional authentication steps in order to be downloaded.

This php app was written in Cake (a Rails-like framework) and what I did  
was  
to put the image processing methods inside a component and then a  
ImagesController would have a privated method to convert everything  
through  
the web interface.

I’m not sure on what would be the best way to implement these in Rails.  
Maybe a web form that would call a rake task that would in turn execute  
the  
whole process?

Any suggestions would be greatly appreciated!

Thanks,

Marcelo.

---

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [October 23, 2007, 1:39am UTC](https://www.ruby-forum.com/t/batch-process-images-in-a-rails-app/117943/2 "2007-10-23T01:39:44Z")

</div>

Any ideas?

---

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [October 23, 2007, 10:46am UTC](https://www.ruby-forum.com/t/batch-process-images-in-a-rails-app/117943/3 "2007-10-23T10:46:27Z")

</div>

Hello,

You can use Backgroundrb. [1]

An example, video conversion with Backgroundrb found in  
[http://escapegoat.org/2007/8/26/video-conversion/](http://escapegoat.org/2007/8/26/video-conversion/) url.

Links:  
[1] [http://backgroundrb.rubyforge.org/](http://backgroundrb.rubyforge.org/)

Regards,  
Murat

–

* * *

Murat Ã‚rif Ã‡ELÄ°KER \< [http://www.ikinoktayazilim.com/wordpress](http://www.ikinoktayazilim.com/wordpress) \>  
Ä°kinokta YazÄ±lÄ±m, Bursa  
[http://www.ikinoktayazilim.com](http://www.ikinoktayazilim.com)
