Subscribe RSS

Archive for the Category "Web Dev"

Doppelganger – Design your own Avatar Jan 19

Always on the look out of stupidly simple, nice to use web apps. Heres one that lets you create  (and edit) an avatar for yourself. Not only can you choose from a large range of features to create your avatar, but they make it a piece of piss to use the avatars on third party sites such as this one.

Get your avatar here: www.doppelme.com

Heres mine:

JQuery 1.4 Jan 19

With the new release of JQuery come a lot of new features and goodies. Hers a great run down of whats new: http://net.tutsplus.com/tutorials/javascript-ajax/jquery-1-4-released-the-15-new-features-you-must-know/

Category: Javascript  | Tags: ,  | Leave a Comment
Creating Thumbnails with imagemagick Dec 31
thumbnails with imagemagick

thumbnails with imagemagick

So you want little square thumbnails like Flickr. Here is a bash script that uses imagemagick to generate square thumbnails.


makethumb:

#!/bin/bash
#
# makethumb
#
# A bash script to generate square thumbnails using imagemagick.
#
# Feel free to use and abuse, its just a script. Requires imagemagick!
# See www.websurfshack.net for more stuff like this
#

if [ "$1" = "" ]; then
echo "Usage: makethumb source_file [size] [output file]"
echo ""
echo "e.g."
echo " makethumb large.jpg"
echo " makethumb large.jpg 65"
echo " makethumb large.jpg 45 thumb.jpg"
echo " makethumb large.jpg 25 thumb.gif"
echo ""
echo "Note: You may specify an output file of a different type to the source. The image will be converted automatically to that type."
echo ""
exit
fi

if [ ! -e "$1" ]; then
echo "Input file "$1" not found. Please specify a valid input file!"
exit
fi

ORIG_FILE="$1"

if [ "$2" = "" ]; then
SIZE="45"
else
SIZE="$2"
fi

if [ "$3" = "" ]; then
THUMB_FILE="THUMB_${ORIG_FILE}"
else
THUMB_FILE="$3"
fi

echo "Creating ${SIZE}x${SIZE} thumbnail '${THUMB_FILE}' from source image '${ORIG_FILE}'"

#Grab the image dimensions
WIDTH=`identify -format '%w' ${ORIG_FILE}`
HEIGHT=`identify -format '%h' ${ORIG_FILE}`
echo "Source image is ${WIDTH}x${HEIGHT}"

if [ $WIDTH = $HEIGHT ]; then
echo "Image is already square so just resizing..."
`convert ${ORIG_FILE} -thumbnail "${SIZE}x${SIZE}" -strip ${THUMB_FILE}`
else
if [ $WIDTH -gt $HEIGHT ]; then
echo "Image is landscape"
`convert ${ORIG_FILE} -resize "x${SIZE}" -gravity NorthWest -crop ${SIZE}x${SIZE}+0+0 +repage -strip ${THUMB_FILE}`
fi
if [ $WIDTH -lt $HEIGHT ]; then
echo "Image is portrait"
`convert ${ORIG_FILE} -resize "${SIZE}" -gravity NorthWest -crop ${SIZE}x${SIZE}+0+0 +repage -strip ${THUMB_FILE}`
fi
fi

NEWFILEDATA=`identify ${THUMB_FILE}`
echo "Output file: ${NEWFILEDATA}"
echo "Done!"

Apache Directory Access Control Oct 22

Apache configuration has a Directory directive. It is used like a .htaccess file to control access to said directory.

An example:

Order deny,allow
Deny from all
Allow from my.domain.com

The important bit here is the Order statement. Rules will be processed from right to left (in this case all of the deny rules then all of the allow rules. The LAST rule that is matched will the the rule that is used. We are denying everyone and allowing wo we specify.

If you were to specify allow,deny you will be allowing everyone and denying who you specify.

This is quite a complicated system and some personal experimentation should help you understand.

Category: Apache, Tutorials, Uncategorized  | Tags: ,  | Leave a Comment