/** * Create all the normalized sizes for the Image. Called by postSave(). */ public function make_sizes() { if (!isset($this->_set_image)) { Carper::croak("image not set for " . $this->img_uuid); } $dir = self::get_directory($this->img_ref_type, $this->img_uuid); $ext = self::$CONFIG[$this->img_ref_type]['convert_to']; $name = self::$CONFIG[$this->img_ref_type]['filename']; // remove old files, and copy a new one array_map("unlink", glob("{$dir}/*")); $fname = $this->img_file_name; copy($this->_set_image, "{$dir}{$fname}"); // convert at full resolution $p = new phMagick($this->_set_image, "{$dir}{$name}.{$ext}"); $p->convert(); // resized versions foreach (self::$CONFIG[$this->img_ref_type]['sizes'] as $size => $dim) { $p = new phMagick($this->_set_image, "{$dir}{$name}_{$size}.{$ext}"); if ($dim[0] == 0 || $dim[1] == 0) { $p->resize($dim[0], $dim[1]); } elseif (is_a($this, 'ImageOrgLogo')) { $p->resize($dim[0], $dim[1]); } else { $p->resizeExactly($dim[0], $dim[1]); } } $this->_set_image = false; }
/** * * * @return array $locked */ public static function get_locked() { Carper::croak("rewrite get_locked to use AIR2_Query dql"); $proto = new JobQueue(); $jobs = $proto->fetchAll("where jq_start_dtim is not null and jq_complete_dtim is null"); $locked = array(); while ($job = $jobs->next()) { $locked[] = $job; } return $locked; }