mkdir(IMG_CACHE_PATH . dirname($_REQUEST['__path']), 0777, true); } if (!file_exists($cache_path)) { throw new Exception('Cache path was not created'); } $cache_name = $cache_path . DIRECTORY_SEPARATOR . basename($_REQUEST['__path']); if (!file_exists(IMG_CACHE_PATH)) { mkdir(IMG_CACHE_PATH, 0777, true); } if (!file_exists($cache_name)) { require BASE_PATH . '/lib/BitrixHelperLib/ImageEditor.class.php'; $IE = new ImageEditorGD(); $IE->setSource($source)->setTarget($cache_name); $size = @coalesce($params['s'], $params['w']); if (isset($params['e']) && (int) $params['e'] > 0 && (int) $params['e'] < 500) { $IE->cutEdgesByPercentage($v, $v, $v, $v); } switch (@$params['t']) { case 'square': $IE->square($size); break; case 'square_put': $IE->putIntoSquare($size); break; case 'put': if (empty($params['w'])) { throw new Exception('Width is not set for method PUT'); } if (empty($params['h'])) { throw new Exception('Height is not set for method PUT'); }