![]() |
API - XOOPS 2.5.11 Beta 2
By monxoops.fr
|
Namespaces | |
| namespace | core |
Functions | |
| doConditionalGet ($etag, $lastModified) | |
| imageCreateCorners ($sourceImage, $radii) | |
| findSharp ($orig, $final) | |
| exit404BadReq () | |
| imageFilenameCheck ($imageUrl) | |
Variables | |
| const | MEMORY_TO_ALLOCATE '100M' |
| const | DEFAULT_IMAGE_QUALITY 90 |
| const | DEFAULT_BACKGROUND_COLOR '000000' |
| const | ONLY_LOCAL_IMAGES true |
| const | ENABLE_IMAGEFILTER true |
| const | ENABLE_ROUNDCORNER true |
| const | ENABLE_IMAGEROTATE true |
| if(function_exists( 'set_magic_quotes_runtime')) if(function_exists('mb_http_output')) | $xoopsOption ['nocommon'] = true |
| $xoopsLogger = XoopsLogger::getInstance() | |
| $imageId = isset($_GET['id']) ? (int)$_GET['id'] : false | |
| $imageUrl = isset($_GET['url']) ? (string)$_GET['url'] : (isset($_GET['src']) ? (string)$_GET['src'] : false) | |
| if(!empty( $imageId)) elseif(!empty($imageUrl)) | else |
| $edited_image_filename = 'editedimage_' . md5($_SERVER['REQUEST_URI']) . '_' . $imageFilename | |
| $cached_image = XoopsCache::read($edited_image_filename) | |
| if(!isset($_GET['nocache']) &&!isset($_GET['noservercache']) &&!empty($cached_image) &&($cached_image['cached_time'] >=$imageCreatedTime)) | $max_width = isset($_GET['width']) ? (int)$_GET['width'] : false |
| $max_height = isset($_GET['height']) ? (int)$_GET['height'] : false | |
| if(! $max_width && $max_height) elseif( $max_width &&! $max_height) elseif(! $max_width &&! $max_height) | $color = isset($_GET['color']) ? preg_replace('/[^0-9a-fA-F]/', '', (string)$_GET['color']) : false |
| $filter = isset($_GET['filter']) ? $_GET['filter'] : false | |
| $radius = isset($_GET['radius']) ? (string)$_GET['radius'] : false | |
| $angle = isset($_GET['angle']) ? (float)$_GET['angle'] : false | |
| if(empty($_GET['width']) &&empty($_GET['height']) &&empty($_GET['color']) &&empty($_GET['filter']) &&empty($_GET['radius']) &&empty($_GET['angle'])) | $offset_x = 0 |
| $offset_y = 0 | |
| if(isset($_GET['cropratio'])) | $xRatio = $max_width / $imageWidth |
| $yRatio = $max_height / $imageHeight | |
| $tn_height = $max_height | |
| $quality = isset($_GET['quality']) ? (int)$_GET['quality'] : DEFAULT_IMAGE_QUALITY | |
| $destination_image = imagecreatetruecolor($tn_width, $tn_height) | |
| $transparent = imagecolorallocatealpha($destination_image, 255, 255, 255, 127) | |
| $imageData = ob_get_contents() | |
| $imageCreatedTime = time() | |
| $cached_image ['edited_image_filename'] = $edited_image_filename | |
| $cached_image ['image_data'] = $imageData | |
| $cached_image ['cached_time'] = $imageCreatedTime | |
| $last_modified_string = gmdate('D, d M Y H:i:s', $imageCreatedTime) . ' GMT' | |
| $etag = md5($imageData) | |
| doConditionalGet | ( | $etag, | |
| $lastModified | |||
| ) |
| $etag | |
| $lastModified |
| exit404BadReq | ( | ) |
issue an error for bad request
Many different issues end up here, so message is generic 404. This keeps us from leaking info by probing

| findSharp | ( | $orig, | |
| $final | |||
| ) |
| $orig | |
| $final |
| imageCreateCorners | ( | $sourceImage, | |
| $radii | |||
| ) |
ref: http://www.tricksofit.com/2014/08/round-corners-on-image-using-php-and-gd-library
| resource | $sourceImage | GD Image resource |
| int[] | $radii | array(top left, top right, bottom left, bottom right) of pixel radius for each corner. A 0 disables rounding on a corner. |
| imageFilenameCheck | ( | $imageUrl | ) |
check local image url for possible issues
| string | $imageUrl | url to local image starting at site root with a '/' |

| $angle = isset($_GET['angle']) ? (float)$_GET['angle'] : false |
| $cached_image = XoopsCache::read($edited_image_filename) |
| $cached_image[ 'cached_time'] = $imageCreatedTime |
| $cached_image[ 'edited_image_filename'] = $edited_image_filename |
| $cached_image[ 'image_data'] = $imageData |
| if(! $max_width &&$max_height) elseif($max_width &&! $max_height) elseif (! $max_width &&! $max_height) $color = isset($_GET['color']) ? preg_replace('/[^0-9a-fA-F]/', '', (string)$_GET['color']) : false |
| $destination_image = imagecreatetruecolor($tn_width, $tn_height) |
| $edited_image_filename = 'editedimage_' . md5($_SERVER['REQUEST_URI']) . '_' . $imageFilename |
| $etag = md5($imageData) |
| $filter = isset($_GET['filter']) ? $_GET['filter'] : false |
| $imageCreatedTime = time() |
| $imageData = ob_get_contents() |
| $imageId = isset($_GET['id']) ? (int)$_GET['id'] : false |
| $imageUrl = isset($_GET['url']) ? (string)$_GET['url'] : (isset($_GET['src']) ? (string)$_GET['src'] : false) |
| $last_modified_string = gmdate('D, d M Y H:i:s', $imageCreatedTime) . ' GMT' |
| $max_height = isset($_GET['height']) ? (int)$_GET['height'] : false |
| if (!isset( $_GET[ 'nocache']) &&!isset( $_GET[ 'noservercache']) &&!empty( $cached_image) &&( $cached_image[ 'cached_time'] >=$imageCreatedTime)) $max_width = isset($_GET['width']) ? (int)$_GET['width'] : false |
| if (empty( $_GET[ 'width']) &&empty( $_GET[ 'height']) &&empty( $_GET[ 'color']) &&empty( $_GET[ 'filter']) &&empty( $_GET[ 'radius']) &&empty( $_GET[ 'angle'])) $offset_x = 0 |
| $offset_y = 0 |
| $quality = isset($_GET['quality']) ? (int)$_GET['quality'] : DEFAULT_IMAGE_QUALITY |
| $radius = isset($_GET['radius']) ? (string)$_GET['radius'] : false |
| $tn_height = $max_height |
| $transparent = imagecolorallocatealpha($destination_image, 255, 255, 255, 127) |
| $xoopsLogger = XoopsLogger::getInstance() |
| if(function_exists('set_magic_quotes_runtime')) if (function_exists( 'mb_http_output')) $xoopsOption[ 'nocommon'] = true |
| if (isset( $_GET[ 'cropratio'])) $xRatio = $max_width / $imageWidth |
| $yRatio = $max_height / $imageHeight |
| const DEFAULT_BACKGROUND_COLOR '000000' |
| const DEFAULT_IMAGE_QUALITY 90 |
| if (!isset( $_GET[ 'nocache']) &&!isset( $_GET[ 'nobrowsercache'])) else |
| const ENABLE_IMAGEFILTER true |
| const ENABLE_IMAGEROTATE true |
| const ENABLE_ROUNDCORNER true |
| const MEMORY_TO_ALLOCATE '100M' |
| const ONLY_LOCAL_IMAGES true |