XOOPS API 2.5.11 Beta1  UI v0.5
Réalisé par monxoops.fr
Référence du fichier image.php

Espaces de nommage

 core
 

Fonctions

 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(@get_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)
 

Documentation des fonctions

◆ doConditionalGet()

doConditionalGet (   $etag,
  $lastModified 
)
Paramètres
$etag
$lastModified
Renvoie
null

◆ exit404BadReq()

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

+ Voici le graphe des appelants de cette fonction :

◆ findSharp()

findSharp (   $orig,
  $final 
)
Paramètres
$orig
$final
Renvoie
mixed

◆ imageCreateCorners()

imageCreateCorners (   $sourceImage,
  $radii 
)

ref: http://www.tricksofit.com/2014/08/round-corners-on-image-using-php-and-gd-library

Paramètres
resource$sourceImageGD Image resource
int[]$radiiarray(top left, top right, bottom left, bottom right) of pixel radius for each corner. A 0 disables rounding on a corner.
Renvoie
resource

◆ imageFilenameCheck()

imageFilenameCheck (   $imageUrl)

check local image url for possible issues

Paramètres
string$imageUrlurl to local image starting at site root with a '/'
Renvoie
bool true if name is acceptable, exit if not
+ Voici le graphe d'appel pour cette fonction :

Documentation des variables

◆ $angle

$angle = isset($_GET['angle']) ? (float)$_GET['angle'] : false

◆ $cached_image [1/4]

$cached_image[ 'cached_time'] = $imageCreatedTime

◆ $cached_image [2/4]

$cached_image[ 'edited_image_filename'] = $edited_image_filename

◆ $cached_image [3/4]

$cached_image[ 'image_data'] = $imageData

◆ $cached_image [4/4]

$cached_image = XoopsCache::read($edited_image_filename)

◆ $color

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

$destination_image = imagecreatetruecolor($tn_width, $tn_height)

◆ $edited_image_filename

$edited_image_filename = 'editedimage_' . md5($_SERVER['REQUEST_URI']) . '_' . $imageFilename

◆ $etag

$etag = md5($imageData)

◆ $filter

$filter = isset($_GET['filter']) ? $_GET['filter'] : false

◆ $imageCreatedTime

$imageCreatedTime = time()

◆ $imageData

$imageData = ob_get_contents()

◆ $imageId

$imageId = isset($_GET['id']) ? (int)$_GET['id'] : false

◆ $imageUrl

$imageUrl = isset($_GET['url']) ? (string)$_GET['url'] : (isset($_GET['src']) ? (string)$_GET['src'] : false)

◆ $last_modified_string

$last_modified_string = gmdate('D, d M Y H:i:s', $imageCreatedTime) . ' GMT'

◆ $max_height

$max_height = isset($_GET['height']) ? (int)$_GET['height'] : false

◆ $max_width

if (!isset( $_GET[ 'nocache']) &&!isset( $_GET[ 'noservercache']) &&!empty( $cached_image) &&( $cached_image[ 'cached_time'] >=$imageCreatedTime)) $max_width = isset($_GET['width']) ? (int)$_GET['width'] : false

◆ $offset_x

if (empty( $_GET[ 'width']) &&empty( $_GET[ 'height']) &&empty( $_GET[ 'color']) &&empty( $_GET[ 'filter']) &&empty( $_GET[ 'radius']) &&empty( $_GET[ 'angle'])) $offset_x = 0

◆ $offset_y

$offset_y = 0

◆ $quality

$quality = isset($_GET['quality']) ? (int)$_GET['quality'] : DEFAULT_IMAGE_QUALITY

◆ $radius

$radius = isset($_GET['radius']) ? (string)$_GET['radius'] : false

◆ $tn_height

$tn_height = $max_height

◆ $transparent

$transparent = imagecolorallocatealpha($destination_image, 255, 255, 255, 127)

◆ $xoopsLogger

$xoopsLogger = XoopsLogger::getInstance()

◆ $xoopsOption

if ( @get_magic_quotes_runtime()) if (function_exists( 'mb_http_output')) $xoopsOption[ 'nocommon'] = true

◆ $xRatio

if (isset( $_GET[ 'cropratio'])) $xRatio = $max_width / $imageWidth

◆ $yRatio

$yRatio = $max_height / $imageHeight

◆ DEFAULT_BACKGROUND_COLOR

const DEFAULT_BACKGROUND_COLOR '000000'

◆ DEFAULT_IMAGE_QUALITY

const DEFAULT_IMAGE_QUALITY 90

◆ else

if (!isset( $_GET[ 'nocache']) &&!isset( $_GET[ 'nobrowsercache'])) else
Valeur initiale :
{
header('Content-type: image/gif')

◆ ENABLE_IMAGEFILTER

const ENABLE_IMAGEFILTER true

◆ ENABLE_IMAGEROTATE

const ENABLE_IMAGEROTATE true

◆ ENABLE_ROUNDCORNER

const ENABLE_ROUNDCORNER true

◆ MEMORY_TO_ALLOCATE

const MEMORY_TO_ALLOCATE '100M'

◆ ONLY_LOCAL_IMAGES

const ONLY_LOCAL_IMAGES true
header
</code > Be careful enabling this directive if you have a redirector script that does not use the< code > Location</code > HTTP header
Definition: URI.MungeResources.txt:10