<?php

/**
 * Subclass for representing a row from the 'photo' table.
 *
 * 
 *
 * @package lib.model
 */ 
    class Photo extends BasePhoto
    {
        public function setFilePath($value) 
        { 
            parent::setFilePath($value); 
            $this->generateThumbnail($value); 
        } 
        public function generateThumbnail($value) 
        { 
            parent::setFilePath($value); 
            $uploadDir = sfConfig::get('sf_upload_dir'); 
            $thumbnail = new sfThumbnail(150, 150); 
            $thumbnail->loadFile($uploadDir.'/'.$this->getFilePath()); 
            $thumbnail->save($uploadDir.'/thumbnail/'.$this->getFilePath(), 'image/png'); 
        }
    }
