/** * ImageMagick based image properties read. */ private function identify() { $rcube = rcube::get_instance(); // use ImageMagick in command line if ($cmd = $rcube->config->get('im_identify_path')) { $args = array('in' => $this->image_file, 'format' => "%m %[fx:w] %[fx:h]"); $id = rcube::exec($cmd . ' 2>/dev/null -format {format} {in}', $args); if ($id) { return explode(' ', strtolower($id)); } } // use PHP's Imagick class if (class_exists('Imagick', false)) { try { $image = new Imagick($this->image_file); return array(strtolower($image->getImageFormat()), $image->getImageWidth(), $image->getImageHeight()); } catch (Exception $e) { } } }
/** * Identify command handler. */ private function identify() { $rcube = rcube::get_instance(); if ($cmd = $rcube->config->get('im_identify_path')) { $args = array('in' => $this->image_file, 'format' => "%m %[fx:w] %[fx:h]"); $id = rcube::exec($cmd . ' 2>/dev/null -format {format} {in}', $args); if ($id) { return explode(' ', strtolower($id)); } } }