Mass Image Processing
I ran into a requirement to create thumbs of all images in my content folder. This shell script can be used to create thumbs of all images or for mass conversion of file formats. The script scans for images with the specified format in all subdirectories and puts the processed file in same path.
The constants can be modified to define the source directory, resolution, source and target filetypes. You need to have ImageMagick installed and configured to get this script working.
The script will create thumbs for each image file in same directory with ‘.thumb’ before the extension.
For ex: my_cool_pic.jpg will have a thumbnail named as my_cool_pic.thumb.png.
Add Google Custom Search to your Rails Application (Business Edition)
Here are the steps to set up a Google CSE for your rails application. In order to use the xml api, first of all you need to have a business account. You can get the xml query format url or more precisely the cx parameter (unique ID of the CSE) from the control panel.
Setup:
Identify your resource to be searched with the help of url patterns. For ex, if the application is RESTful, it is easy to index something like http://someshop.com/products. Configure your CSE for the above url pattern so that http://someshop.com/products/1, http://someshop.com/products/2.. etc get indexed by the search engine.
Code:
The GoogleSearch class sends a GET request to fetch the results xml, which is parsed using the Hpricot parser.
Output:
Now you could get the urls of search results as an array. Likewise, you can fetch other parameters from resultant xml by referring the this doc..


