Hi,
I am adding the option of specifying the left column and image width in the CMS in the Left Sidebar tab.
The user enters the width in the sidebar tab (e.g., 200px). I need to take that value, trim the px off, and
then minus the image border width, which is 4px total, 2px on the left 2px on the right so that the width of image equals the width of column.
I've tried variations of the following with no luck:
class Page_Controller extends ContentController {
}
class Page_Photo extends Image {
function generateLeftPhotoWidth($gd) {
$gd->setQuality(100);
return $gd->resizeByWidth(substr_replace($this->LeftWidth ,"",-2)-4);
}
}
In the above code, I tried to remove last two characters "px" of $LeftWidth and then subtract 4.
And in Page.ss, I have:
<img src="$LeftPhoto.LeftPhotoWidth.URL" title="$TitleText" alt="$AltText" />
Any ideas anyone?
Thanks,
Sam