With my experience working with images the best way is to make use of the php gd function by extend the image class.
1. create a php file called FittedImage.php
<?php
class FittedImage extends Image {
function generateMainImage($gd) {
$gd->setQuality(80);
return $gd->resizeRatio(370,240);
}
function generateThumbImage($gd) {
$gd->setQuality(80);
return $gd->resize(120,80);
}
}
?>
2.
static $has_one = array(
'GalleryImage' => 'FittedImage ',
);
3.
in you Template it can be
<img src="$GalleryImage.ThumbImage.URL" />
this will be for the small image which (may be ) on mouseover it displays the MainImage in another div
for the Main image
<img src="$GalleryImage.MainImage.URL" />
let me know if you need a URL for the site where this functionality is in place.
hope this makes sense
this is clearly explained here
http://doc.silverstripe.org/doku.php?id=recipes:imageupload