/** * @ignore */ function TransformImage($srcSpec, $destSpec, $size = '') { return cge_image::transform_image($srcSpec, $destSpec, $size); }
/** * Handle the upload of a file. * This method will generate thumbnails from images that are in the accepted filetypes. * * @param string $name The input field name from the form's input field of type FILE. * @param string $destfilename The destination filename. * @param bool $subfield * @return string The basename of the uploaded file. */ public function handle_upload($name, $destfilename = '', $subfield = false) { $res = parent::handle_upload($name, $destfilename, $subfield); if (!$res) { return false; } $src = $this->get_dest_filename(); if (!$this->is_accepted_imagefile($src)) { // not an image file, nothing more to do. return $res; } if ($this->_do_thumbnail && $this->_thumbnail_size > 0) { // I guess we're making a thumbnail. $bn = basename($this->get_dest_filename()); $filename = 'thumb_' . $bn; $dest = cms_join_path($this->get_dest_dir(), $filename); // todo: check to see if the input is greater than the thumbnail size. cge_image::transform_image($src, $dest, $this->_thumbnail_size); } return basename($this->get_dest_filename()); }