= $img_info['width'] && $iconHeight >= $img_info['height']) || ($iconWidth == $img_info['width'] && $iconHeight == 0) || ($iconHeight == $img_info['height'] && $iconWidth == 0) ) { return $fileName; } $iconName = ImageFS::getIconName($fileName, $iconWidth, $iconHeight, $force); if (!is_file($iconName)) { $tempnamFile = tempnam('/tmp', 'rsz'); if (copy($fileName, $tempnamFile)) { // $tempnamIcon = tempnam('/tmp', $iconName); $tempnamIcon = tempnam('/tmp', 'rsz2'); $resizer = new resizer($tempnamFile, $iconWidth, $iconHeight, $tempnamIcon); copy($tempnamIcon, $iconName); unlink($tempnamFile); unlink($tempnamIcon); } } return $iconName; } function resizeEx($fileName, $iconWidth, $iconHeight, $iconName, $force = false) { if (!is_file($fileName)) { return false; } $iconWidth = (int)$iconWidth; $iconHeight = (int)$iconHeight; $force = (bool)$force; $img_info = ImageFS::getInfo($fileName); if (empty($img_info) || (!$iconHeight && !$iconWidth) || ($iconWidth >= $img_info['width'] && $iconHeight >= $img_info['height']) || ($iconWidth == $img_info['width'] && $iconHeight == 0) || ($iconHeight == $img_info['height'] && $iconWidth == 0) ) { copy($fileName, $iconName); return $iconName; } if (!is_file($iconName)) { $tempnamFile = tempnam('/tmp', 'rsz'); if (copy($fileName, $tempnamFile)) { $tempnamIcon = tempnam('/tmp', 'rsz2'); $resizer = new resizer($tempnamFile, $iconWidth, $iconHeight, $tempnamIcon); copy($tempnamIcon, $iconName); unlink($tempnamFile); unlink($tempnamIcon); } } return $iconName; } function delete($name) { ImageFS::delIcons($name); return unlink($name); } function delIcons($fullName) { $path_parts = pathinfo($fullName); $name = substr($path_parts['basename'], 0, -(strlen($path_parts['extension']) + 1)); if (is_dir($path_parts['dirname'])) { if ($dh = opendir($path_parts['dirname'])) { while (($file = readdir($dh)) !== false) { if (preg_match("/^{$name}_\d+[xX]\d+\.{$path_parts['extension']}$/", $file)) { unlink($path_parts['dirname'] . '/' . $file); } } closedir($dh); } } return true; } } function fck_image_fs($name, $width = 0, $height = 0, $force = false) { $width = intval($width); $height = intval($height); $iconName = ImageFS::getIconName($name, $width, $height, $force); $iconName = str_replace(WWW_PATH.'/fckfiles', BASE_URL.'/fckthumbs', $iconName); return $iconName; } function image_fs($name, $width = 0, $height = 0, $force = false) { $width = intval($width); $height = intval($height); if ($width || $height){ $name = ImageFS::resize($name, $width, $height, $force); } return $name; } function image_fs_full($name, $width = 0, $height = 0, $force = false) { if ($width || $height) { $iconName = ImageFS::resize($name, $width, $height, $force); } else { $iconName = $name; } $imgArr = ImageFS::getInfo($iconName); $out = ' src="' . $iconName . '" '; if ($imgArr['width']) { $out .= 'width="' . $imgArr['width'] . '" '; } if ($imgArr['height']){ $out .= 'height="' . $imgArr['height'] . '" '; } return $out; }