Flickr block square thumbnails

Permalink
Through the flickr block, I am trying to come up with a way to resize and crop images gracefully.

I have got a function written, but I am not sure how to incorporate it into the block. That code is:

<?php 
function createThumb($source,$dest) {
   $thumb_size = 100;
   $size = getimagesize($source);
   $width = $size[0];
   $height = $size[1];
   if($width> $height) {
      $x = ceil(($width - $height) / 2 );
      $width = $height;
   } elseif($height> $width) {
      $y = ceil(($height - $width) / 2);
      $height = $width;
   }
   $new_im = ImageCreatetruecolor($thumb_size,$thumb_size);
   $im = imagecreatefromjpeg($source);


Does anyone have some suggestions?

AnotherAndrew