public function resize($image, $group_id) { if (lc_empty(CFG_APP_IMAGEMAGICK_CONVERT) || !@file_exists(CFG_APP_IMAGEMAGICK_CONVERT) || utility::execEnabled() === false) { return $this->resizeWithGD($image, $group_id); } if (!file_exists(DIR_FS_CATALOG . DIR_WS_IMAGES . 'products/' . $this->_groups[$group_id]['code'])) { mkdir(DIR_FS_CATALOG . DIR_WS_IMAGES . 'products/' . $this->_groups[$group_id]['code']); @chmod(DIR_FS_CATALOG . DIR_WS_IMAGES . 'products/' . $this->_groups[$group_id]['code'], 0777); } exec(escapeshellarg(CFG_APP_IMAGEMAGICK_CONVERT) . ' -resize ' . (int) $this->_groups[$group_id]['size_width'] . 'x' . (int) $this->_groups[$group_id]['size_height'] . ($this->_groups[$group_id]['force_size'] == '1' ? '!' : '') . ' ' . escapeshellarg(DIR_FS_CATALOG . DIR_WS_IMAGES . 'products/' . $this->_groups[1]['code'] . '/' . $image) . ' ' . escapeshellarg(DIR_FS_CATALOG . DIR_WS_IMAGES . 'products/' . $this->_groups[$group_id]['code'] . '/' . $image)); @chmod(DIR_FS_CATALOG . DIR_WS_IMAGES . 'products/' . $this->_groups[$group_id]['code'] . '/' . $image, 0777); }
/** * Restore from full file backup zip * * @access public * @return boolean */ public static function fullFileRestore($version) { $ext = '.zip'; $restore_file = $version . $ext; if (file_exists(DIR_FS_WORK . 'updates/' . $restore_file)) { // remove old zip extraction if any $parent_dir = explode('/', DIR_FS_CATALOG); if (is_dir(DIR_FS_WORK . 'updates/' . $parent_dir[1])) { self::rmdir_r(DIR_FS_WORK . 'updates/' . $parent_dir[1]); } // restore full file backup if (utility::execEnabled() === true && utility::isLinux() === true) { try { // unzip the archive into work/updates/ exec(CFG_APP_UNZIP . ' ' . DIR_FS_WORK . 'updates/' . $restore_file . ' -d ' . DIR_FS_WORK . 'updates/'); //copy the files exec('\\cp -fr ' . DIR_FS_WORK . 'updates' . DIR_FS_CATALOG . '* ' . DIR_FS_CATALOG); // cleanup if (is_dir(DIR_FS_WORK . 'updates/' . $parent_dir[1])) { self::rmdir_r(DIR_FS_WORK . 'updates/' . $parent_dir[1]); } return array('rpcStatus' => 1); } catch (Exception $e) { return array('rpcStatus' => 0); } } else { if (extension_loaded('zip')) { try { self::_extractZip(DIR_FS_WORK . 'updates/' . $restore_file, dirname(DIR_FS_CATALOG)); if (is_dir(DIR_FS_WORK . 'updates/' . $parent_dir[1])) { self::rmdir_r(DIR_FS_WORK . 'updates/' . $parent_dir[1]); } return array('rpcStatus' => 1); } catch (Exception $e) { return array('rpcStatus' => 0); } } else { return array('rpcStatus' => -1); } } } else { return array('rpcStatus' => -2); } }