Christoffer Kjølbæk I have a blog, therefore I am…

7Oct/102

Howto resize a lot of images

If you have a lot of images and want them all resized, use mogrify from ImageMagick

Say you want all images to be 1000 pixels wide, simply do

mogrify -resize 1000 *.jpg

If you want all images to be max 100x100 pixels, and keep the aspect ratio do

mogrify -resize 100x100 *.jpg

If you want to force the image to be 100x100 pixels do

mogrify -resize 100x100! *.jpg

Read more at http://www.imagemagick.org/script/mogrify.php

Tagged som: , 2 Kommentarer
14Aug/100

Using UUID for USB harddrives in fstab

If you use a number of USB hard drives attached to a server (or desktop), you will notice that they (can) come up with different device names after each reboot. Because of the different names, it is difficult to use the names in /etc/fstab. To avoid this problem, it is possible to use UUID instead, which is an unique id number for each partition.

If you fstab line for the USB disk looks like

/dev/sdc2 /nas/data ext3 errors=remount-ro 0 1

You should get the UUID of /dev/sdc2 by running

blkid /dev/sdb2

Which gives something like

/dev/sdb2: LABEL="maxtor_b_data" UUID="b7a042b2-60c6-4116-8324-065a3d23520d" TYPE="ext3"

Change the fstab line to

UUID=b7a042b2-60c6-4116-8324-065a3d23520d /nas/data ext3 errors=remount-ro 0 1

And you are ready to go :)

18Jul/100

PHP function to get current SVN ID

Make a function like the below in you PHP file

function get_rev() {
	return (int)substr(substr('$Rev: 168 $', 6), 0, -2);
}

And add the Revision keyword to the properties of the file

svn propset svn:keywords Revision your_file.php

"$Rev: 168 $" will then automatically be updated on every commit.