Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Files & Images Administraction do not work after i extend image class


Reply


5 Posts   1583 Views

Avatar
msantang

Community Member, 41 Posts

11 May 2007 at 12:18pm

Hi here is my code in Producto.php, is a little change from the "extend a basic site" tutorial. (staff part)

class Producto extends Page {
   static $db = array(
   );
   static $has_one = array(
   'Foto' => 'ProductPage_Image'
   );

   function getCMSFields() {
      $fields = parent::getCMSFields();

      $fields->addFieldToTab("Root.Content.Images", new ImageField('Foto'));
      return $fields;
   }
}

class Producto_Controller extends Page_Controller {

}

class ProductPage_Image extends Image {
   function generateThumbnail(GD $gd, $width, $heigth) {
      $gd->setQuality(90);
      return $gd->paddedResize($width,$heigth,"F0F0F0");
   }
   
   public function Thumbnail($width)
   {
      return $this->getFormattedImage('Thumbnail',$width, 70);
   }
}

i create a few page of this type and add images to every product.
All this works perfect in live site, Thumbnail are created perfect.

But in CMS when click "Files & Images" i get : Fatal error: Class 'ProductPage_Image' not found in D:\...\sapphire\core\model\DataObject.php on line 1096

Why i get this error?

Avatar
Sean

Forum Moderator, 922 Posts

11 May 2007 at 2:07pm

Have you tried entering the admin panel doing ?flush=1 at the end of the URL? Perhaps there is some caching somewhere.

eg. http://www.mysite.com/admin?flush=1

also, try: http://www.mysite.com/db/build?flush=1 in case there's something missing.

Hopefully that should shed some light on the situation.

Cheers,
Sean

Avatar
Sam

Administrator, 685 Posts

11 May 2007 at 3:48pm

The class ProductPage_Image *must* be in a file called ProductPage.php

If you want to put it into Producto.php, you should rename the class to Prodocto_Image. If you do this, remember to run db/build, and then edit the current images in the database, changing the File.ClassName field.

Avatar
msantang

Community Member, 41 Posts

11 May 2007 at 11:20pm

I will fix it and tell you the results.

Thanks.

And Great Work with this CMS, and tanks to open it to the community.

Avatar
msantang

Community Member, 41 Posts

12 May 2007 at 9:24am

Works Perfect Thanks.