[ create a new paste ] login | about

Link: http://codepad.org/hP9e4pCA    [ raw code | output | fork ]

PHP, pasted on Apr 30:
<?php
class ImageGalleryPageImage extends DataObject {
 
   static $db = array(
   );
   static $has_one = array(
      'ParentImageGalleryPage' => 'ImageGalleryPage',
	  'GalleryImage' => 'ImageGalleryPageImage_CustomImage',
	  //'GalleryImage' => 'Image'
   );
 
   function getCMSFields_forPopup() {
      $fields = new FieldSet();
	  
	  $fields->push( new ImageField( 'GalleryImage', 'Gallery Image' ) );
	  $fields->push( new LiteralField( 'literalfield_1', '<div>For best result, use image size of 930x500.</div><br>' ) );
	  
      return $fields;
   }
   
   public function getTooltipThumbnail() {return $this->GalleryImage()->BackendThumbnail();}
}

class ImageGalleryPageImage_CustomImage extends Image {
	function generateCustomImage($gd){
		$gd->setQuality(85);
		return $gd->resizeRatio(930, 500);
	}
	function generateCustomThumbnailImage($gd){
		$gd->setQuality(85);
		return $gd->paddedResize(98, 66, '#D2D2D2');
	}
	function generateBackendThumbnail($gd){
		$gd->setQuality(85);
		return $gd->resizeRatio(300, 300);
	}
}

?>


Output:
1
2

Fatal error: Class 'DataObject' not found on line 2


Create a new paste based on this one


Comments: