Saturday, June 6, 2009

Image Format Convertor : Script

To Covert all images from one folder from one format to another format

Create file test.sh
Add following line to that file

for i in *png

do
echo $i
temp=$(echo $i | sed -e 's|\.png||')
convert -resize 640x200 $i $temp.gif
done

Save file
Chmod +x test.sh
Run File : ./test.sh


Here I have used .png and .gif. We can try with other .jpg, .jpeg, tif, ttf, bmp etc.

Friday, May 29, 2009

mogrify : ImageMagic

Install ImageMagic :

apt-get install imagemagick

mogrify - With the use of resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more. Mogrify overwrites the original image file, whereas, convert(1) writes to a different image file

e.g Let's resize images

mogrify -resize 500x300 Test/*.png

Thursday, April 23, 2009

Unpack/Decompress Java Script

For better security of code you can compress your javascript using PACKER
  1. Copy the script to http://dean.edwards.name/packer/
  2. Check the both option
  3. Paste to original place and save that script

And to Decompress that script Simply follow two steps :
  1. Put Eval = alert on the top of your script (In Opera browser :))
  2. Select all that output of script and paste that code to :http://jsbeautifier.org/

Wednesday, April 22, 2009

Change FCKEditor font size listing in Numeric value

Find the file fckconfig.js in FCKEditor fckconfig.js

Change the line

FCKConfig.FontSizes = 'smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large' ;

with

FCKConfig.FontSizes = '1/5;2/6;3/7;4/8;5/9;6/10;7/11;8/12;9/14;10/16;11/18;12/20;13/24;14/28;15/30;16/60;17/90' ;


And you will get Numeric list in your FCKEditor instead of String.

Open uploaded pdf files in other browser tab with drupal

As in MAC OS and Linux the uploaded file in drupal site is default open with Save As Dialog box, but where as in Windows the pdf file is open in current browser window.

To Open that pdf in other window

In the core upload module of Drupal go to modules/upload/upload.module is where you will find the function theme_upload_attachments() as follows:

function theme_upload_attachments($files) {
$header = array(t('Attachment'), t('Size'));
$rows = array();
foreach (
$files as $file) {
$file = (object)$file;
if (
$file->list && empty($file->remove)) {
$href = file_create_url($file->filepath);
$text = $file->description ? $file->description : $file->filename;
$rows[] = array(l($text, $href), format_size($file->filesize));
}
}
if (
count($rows)) {
return
theme('table', $header, $rows, array('id' => 'attachments'));
}
}


In this function change

$rows[] = array(l($text, $href), format_size($file->filesize));

with

$rows[] = array(l($text, $href, array('attributes' => array('target' => '_blank'))), format_size($file->filesize));


And you can get files are being open in other browser tab rather than current browser window.
 

webcounter