Sponsorenverwaltung - Team StarCraft e.V.
 All Data Structures Files Functions Variables
img.php File Reference

Handles scaling and image loading. More...

Go to the source code of this file.

Functions

 loadImage ($path)
 
 resizeImage ($path, $width, $height)
 
 saveImage ($img, $path, $extension, $quality=100)
 

Variables

 $absPath = str_replace('\\','/',realpath(dirname(__FILE__))).'/'
 used to get absolute path to the script root More...
 
const ABS_PATH $absPath
 absolute path to the script root More...
 
const NO_PREVIEW 'inc/img/no_preview.png'
 image to load on error More...
 
 $maxHeight = (isset($_GET['max_height']) && ctype_digit($_GET['max_height'])) ? $_GET['max_height'] : 60
 holds maximum height More...
 
 $maxWidth = (isset($_GET['max_width']) && ctype_digit($_GET['max_width'])) ? $_GET['max_width'] : 120
 holds maximum width More...
 
 $filename = $_GET['file']
 holds file to load More...
 

Detailed Description

Handles scaling and image loading.

To specify the image to load use http get var 'file'. To specify the maximum height and maximum width use http get vars 'max_height' and 'max_width'. Scaled photos are stored in a subfolder '_scaled' for further use. Output format is png.

Version
1.0.0
Author
Daniel Seichter
Date
02.07.2013

Definition in file img.php.

Function Documentation

loadImage (   $path)

Loads image depending on the type

Parameters
string$pathpath to the image
Returns
mixed
  • img if the image was loaded
  • FALSE if an error occured
Author
Daniel Seichter

Definition at line 39 of file img.php.

Referenced by resizeImage().

+ Here is the caller graph for this function:

resizeImage (   $path,
  $width,
  $height 
)

Resize image depending on the type (and handle transparancy)

Parameters
string$pathpath to the image
integer$widthmaximum width for scaled image
integer$heightmaximum height for scaled image
Returns
mixed
  • img if the image was loaded
  • FALSE if an error occured
Author
Daniel Seichter

Definition at line 71 of file img.php.

References $height, $width, and loadImage().

+ Here is the call graph for this function:

saveImage (   $img,
  $path,
  $extension,
  $quality = 100 
)

Save image depending on the type

Parameters
mixed$imgimage ressource
string$pathpath for saving (including filename and extension)
integer$extension
  • IMAGETYPE_JPEG
  • IMAGETYPE_GIF
  • IMAGETYPE_PNG
integer$quality[optional]
  • quality (only used if $extension is IMAGETYPE_JPEG)
  • Default: 100
Returns
boolean on success TRUE else FALSE if an error occured
Author
Daniel Seichter

Definition at line 136 of file img.php.

Variable Documentation

$absPath = str_replace('\\','/',realpath(dirname(__FILE__))).'/'

used to get absolute path to the script root

Definition at line 21 of file img.php.

$filename = $_GET['file']

holds file to load

Definition at line 157 of file img.php.

Referenced by fetchSponsorCarAttachments(), and hasSecurityHeader().

$maxHeight = (isset($_GET['max_height']) && ctype_digit($_GET['max_height'])) ? $_GET['max_height'] : 60

holds maximum height

Definition at line 153 of file img.php.

$maxWidth = (isset($_GET['max_width']) && ctype_digit($_GET['max_width'])) ? $_GET['max_width'] : 120

holds maximum width

Definition at line 155 of file img.php.

const ABS_PATH $absPath

absolute path to the script root

Definition at line 26 of file img.php.

const NO_PREVIEW 'inc/img/no_preview.png'

image to load on error

Definition at line 29 of file img.php.