Ejemplo n.º 1
0
 public function cacheIt($width = null, $height = null, $mode = 'equal')
 {
     $w = isset($width) ? $width : $this->m_width;
     $h = isset($height) ? $height : $this->m_height;
     $p = new Picture($this->m_filename);
     if ($w == null && $h == null) {
         $mode = 'equal';
     }
     $search_filename = Picture::getPictureFilename($this->m_filename, $w, $h, $mode);
     if (!file_exists($search_filename)) {
         switch ($mode) {
             case 'redim':
                 $p->dimensionTo($w, $h);
                 break;
             case 'crop':
                 $p->cropTo($w, $h);
                 break;
         }
         $p->toFile($search_filename);
     }
     if (file_exists($search_filename)) {
         list($width, $height, $type, $attr) = getimagesize($search_filename);
         return array('width' => $width, 'height' => $height);
     }
 }