I need to modify the Gallery>Latest Pictures widget slightly to pass through a thumbnail url and a full image URL. I want them both scaled to a certain size;
I have managed to get the URL for the original image but would like your guys' help with getting a resized image in the same way that the Thumbnail is resized
LatestPicturesWidget.php:
function Pictures() {
Requirements::css("widgets_gallery/LatestPicturesWidget.css");
$nrtoshow = (0<$this->NumberToShow) ? $this->NumberToShow : $this->defaults["NumberToShow"];
$pictures = DB::query("SELECT f.`ID`, f.`Filename`, f.`Name`, f.`Title`, s.`URLSegment` FROM `gallerypage_live` g LEFT JOIN `sitetree_live` s ON g.`ID` = s.`ID` LEFT JOIN `file` f ON f.`ParentID` = g.`FolderID` WHERE f.`ClassName` = 'Image' ORDER BY f.`Created` DESC LIMIT 0,$nrtoshow;");
$thumbnails = new DataObjectSet;
foreach ($pictures as $picture){
$picture["GalleryLink"] = Director::baseURL().$picture["URLSegment"];
$thumbnail = new Image($picture);
$thumbnail = $thumbnail->getFormattedImage( "PaddedImage", $this->ThumbnailWidth, $this->ThumbnailHeight);
$thumbnail->setField("GalleryLink", Director::baseURL().$picture["URLSegment"]);
$thumbnail->setField("MainLink",Director::baseURL().$picture['Filename']);
$thumbnail->setField("Name", $picture["Name"]);
$thumbnail->setField("Title", $picture["Title"]);
$thumbnails->push($thumbnail);
}
unset($pictures);
return $thumbnails;
}
LatestPicturesWidget.ss:
<% control Pictures %>
<li>
<!--<a href="$GalleryLink"><img src="$Filename" alt="" title="$Title" class="LatestPicturesImage" /></a>-->
<a href="$MainLink" class="fancybox" rel="group" title="$Title"><img src="$Filename" alt="" title="$Title" class="LatestPicturesImage" /></a>
</li>
<% end_control %>
Thanks in advance