diff --git a/docs/api/classes/CHttpGet.html b/docs/api/classes/CHttpGet.html index 677dd54..a456b80 100644 --- a/docs/api/classes/CHttpGet.html +++ b/docs/api/classes/CHttpGet.html @@ -111,7 +111,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -136,10 +136,10 @@
    - + \
    -
    +
    @@ -727,7 +727,7 @@

    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/classes/CImage.html b/docs/api/classes/CImage.html index 7080e6b..ee5a40f 100644 --- a/docs/api/classes/CImage.html +++ b/docs/api/classes/CImage.html @@ -111,7 +111,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -136,10 +136,10 @@
    - + \
    -
    +
    @@ -254,7 +254,7 @@
    - No protected methods found + getTargetImageExtension()
    No protected properties found @@ -286,7 +286,7 @@ $imageFolder
    $imageSrc
    $pathToImage
    - $fileExtension
    + $fileType
    $extension
    $outputFormat
    $verbose
    @@ -987,11 +987,11 @@ decides (partly) what properties are created.

    - +
    -

    $fileExtension

    -
    $fileExtension : 
    -

    Original file extension

    +

    $fileType

    +
    $fileType : 
    +

    File type for source image, as provided by getimagesize()

    Type

    @@ -2621,7 +2621,7 @@ processing can be done.

    failedToLoad()

    failedToLoad() : void
    -

    Error message when failing to load somehow corrupt image.

    +

    To display error message when failing to load somehow corrupt image.

    @@ -2647,7 +2647,8 @@ processing can be done.

    load()

    load(string  $src = null, string  $dir = null) : $this
    -

    Load image from disk.

    +

    Load image from disk. Try to load image without verbose error message, +if fail, load again and display error messages.

    Parameters

    @@ -3319,7 +3320,36 @@ alpha 00000000-FFFFFF7F.

    -
    +
    +
    + +
    +

    getTargetImageExtension()

    + +
    getTargetImageExtension() : string
    +

    Find out the type (file extension) for the image to be saved.

    + + + + +

    Returns

    + string + —

    as image extension.

    + +
    +
    + +
    + +
    @@ -3655,7 +3685,7 @@ alpha 00000000-FFFFFF7F.


    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/classes/CRemoteImage.html b/docs/api/classes/CRemoteImage.html index c83885d..2f7d58d 100644 --- a/docs/api/classes/CRemoteImage.html +++ b/docs/api/classes/CRemoteImage.html @@ -111,7 +111,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -136,10 +136,10 @@
    - + \
    -
    +
    @@ -976,7 +976,7 @@ a remote file.


    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/classes/CWhitelist.html b/docs/api/classes/CWhitelist.html index 73bbb8c..145e183 100644 --- a/docs/api/classes/CWhitelist.html +++ b/docs/api/classes/CWhitelist.html @@ -111,7 +111,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -136,10 +136,10 @@
    - + \
    -
    +
    @@ -413,7 +413,7 @@ whitelist should be a regexp without the surrounding / or #.


    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/files/CHttpGet.html b/docs/api/files/CHttpGet.html index 83c9bfd..67f8e9b 100644 --- a/docs/api/files/CHttpGet.html +++ b/docs/api/files/CHttpGet.html @@ -111,7 +111,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -136,10 +136,10 @@
    - + \
    -
    +
    @@ -245,7 +245,7 @@

    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/files/CImage.html b/docs/api/files/CImage.html index 5fb1379..ff33479 100644 --- a/docs/api/files/CImage.html +++ b/docs/api/files/CImage.html @@ -111,7 +111,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -136,10 +136,10 @@
    - + \
    -
    +
    @@ -245,7 +245,7 @@

    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/files/CImage.php.txt b/docs/api/files/CImage.php.txt index 7513b0d..b2020e4 100644 --- a/docs/api/files/CImage.php.txt +++ b/docs/api/files/CImage.php.txt @@ -135,9 +135,9 @@ class CImage /** - * Original file extension + * File type for source image, as provided by getimagesize() */ - private $fileExtension; + private $fileType; @@ -513,6 +513,10 @@ class CImage */ public function downloadRemoteSource($src) { + if (!$this->isRemoteSourceOnWhitelist($src)) { + throw new Exception("Hostname is not on whitelist for remote sources."); + } + $remote = new CRemoteImage(); $cache = $this->saveFolder . "/remote/"; @@ -568,10 +572,6 @@ class CImage $this->imageSrc = ltrim($src, '/'); $this->imageFolder = rtrim($dir, '/'); $this->pathToImage = $this->imageFolder . '/' . $this->imageSrc; - $this->fileExtension = strtolower(pathinfo($this->pathToImage, PATHINFO_EXTENSION)); - //$this->extension = $this->fileExtension; - - $this->checkFileExtension($this->fileExtension); return $this; } @@ -776,13 +776,14 @@ class CImage or $this->raiseError('Image file does not exist.'); // Get details on image - $info = list($this->width, $this->height, $this->type, $this->attr) = getimagesize($file); + $info = list($this->width, $this->height, $this->fileType, $this->attr) = getimagesize($file); !empty($info) or $this->raiseError("The file doesn't seem to be an image."); if ($this->verbose) { - $this->log("Image file: {$file}"); - $this->log("Image width x height (type): {$this->width} x {$this->height} ({$this->type})."); - $this->log("Image filesize: " . filesize($file) . " bytes."); + $this->log("Loading image details for: {$file}"); + $this->log(" Image width x height (type): {$this->width} x {$this->height} ({$this->fileType})."); + $this->log(" Image filesize: " . filesize($file) . " bytes."); + $this->log(" Image mimetype: " . image_type_to_mime_type($this->fileType)); } return $this; @@ -1047,7 +1048,7 @@ class CImage $this->extension = $saveAs; } - $this->log("Prepare to save image using as: " . $this->extension); + $this->log("Prepare to save image as: " . $this->extension); return $this; } @@ -1201,15 +1202,17 @@ class CImage $this->extension = isset($this->extension) ? $this->extension - : $parts['extension']; + : (isset($parts['extension']) + ? $parts['extension'] + : null); + + $extension = empty($this->extension) + ? null + : "." . $this->extension; - $optimize = null; - if ($this->extension == 'jpeg' || $this->extension == 'jpg') { - $optimize = $this->jpegOptimize ? 'o' : null; - } elseif ($this->extension == 'png') { - $optimize .= $this->pngFilter ? 'f' : null; - $optimize .= $this->pngDeflate ? 'd' : null; - } + $optimize = $this->jpegOptimize ? 'o' : null; + $optimize .= $this->pngFilter ? 'f' : null; + $optimize .= $this->pngDeflate ? 'd' : null; $convolve = null; if ($this->convolve) { @@ -1228,7 +1231,7 @@ class CImage . $crop_x . $crop_y . $upscale . $quality . $filters . $sharpen . $emboss . $blur . $palette . $optimize . $scale . $rotateBefore . $rotateAfter . $autoRotate . $bgColor . $convolve - . '.' . $this->extension; + . $extension; return $this->setTarget($file, $base); } @@ -1271,7 +1274,7 @@ class CImage /** - * Error message when failing to load somehow corrupt image. + * To display error message when failing to load somehow corrupt image. * * @return void * @@ -1280,29 +1283,15 @@ class CImage { header("HTTP/1.0 404 Not Found"); echo("CImage.php says 404: Fatal error when opening image.
    "); - - switch ($this->fileExtension) { - case 'jpg': - case 'jpeg': - $this->image = imagecreatefromjpeg($this->pathToImage); - break; - - case 'gif': - $this->image = imagecreatefromgif($this->pathToImage); - break; - - case 'png': - $this->image = imagecreatefrompng($this->pathToImage); - break; - } - + $image = imagecreatefromstring(file_get_contents($this->pathToImage)); exit(); } /** - * Load image from disk. + * Load image from disk. Try to load image without verbose error message, + * if fail, load again and display error messages. * * @param string $src of image. * @param string $dir as base directory where images are. @@ -1316,46 +1305,30 @@ class CImage $this->setSource($src, $dir); } - $this->log("Opening file as {$this->fileExtension}."); + $this->loadImageDetails($this->pathToImage); - switch ($this->fileExtension) { - case 'jpg': - case 'jpeg': - $this->image = @imagecreatefromjpeg($this->pathToImage); - $this->image or $this->failedToLoad(); - break; + $this->image = @imagecreatefromstring(file_get_contents($this->pathToImage)); + $this->image or $this->failedToLoad(); + + if (image_type_to_mime_type($this->fileType) == 'image/png') { + $type = $this->getPngType(); + $hasFewColors = imagecolorstotal($this->image); - case 'gif': - $this->image = @imagecreatefromgif($this->pathToImage); - $this->image or $this->failedToLoad(); - break; - - case 'png': - $this->image = @imagecreatefrompng($this->pathToImage); - $this->image or $this->failedToLoad(); - - $type = $this->getPngType(); - $hasFewColors = imagecolorstotal($this->image); - - if ($type == self::PNG_RGB_PALETTE || ($hasFewColors > 0 && $hasFewColors <= 256)) { - if ($this->verbose) { - $this->log("Handle this image as a palette image."); - } - $this->palette = true; + if ($type == self::PNG_RGB_PALETTE || ($hasFewColors > 0 && $hasFewColors <= 256)) { + if ($this->verbose) { + $this->log("Handle this image as a palette image."); } - break; - - default: - $this->image = false; - throw new Exception('No support for this file extension.'); + $this->palette = true; + } } if ($this->verbose) { - $this->log("imageistruecolor() : " . (imageistruecolor($this->image) ? 'true' : 'false')); - $this->log("imagecolorstotal() : " . imagecolorstotal($this->image)); - $this->log("Number of colors in image = " . $this->colorsTotal($this->image)); + $this->log("Image successfully loaded from file."); + $this->log(" imageistruecolor() : " . (imageistruecolor($this->image) ? 'true' : 'false')); + $this->log(" imagecolorstotal() : " . imagecolorstotal($this->image)); + $this->log(" Number of colors in image = " . $this->colorsTotal($this->image)); $index = imagecolortransparent($this->image); - $this->log("Detected transparent color = " . ($index > 0 ? implode(", ", imagecolorsforindex($this->image, $index)) : "NONE") . " at index = $index"); + $this->log(" Detected transparent color = " . ($index > 0 ? implode(", ", imagecolorsforindex($this->image, $index)) : "NONE") . " at index = $index"); } return $this; @@ -1750,7 +1723,7 @@ class CImage */ public function rotateExif() { - if (!in_array($this->fileExtension, array('jpg', 'jpeg'))) { + if (!in_array($this->fileType, array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM))) { $this->log("Autorotate ignored, EXIF not supported by this filetype."); return $this; } @@ -2094,6 +2067,22 @@ class CImage + /** + * Find out the type (file extension) for the image to be saved. + * + * @return string as image extension. + */ + protected function getTargetImageExtension() + { + if (isset($this->extension)) { + return strtolower($this->extension); + } else { + return image_type_to_extension($this->fileType); + } + } + + + /** * Save image. * @@ -2111,7 +2100,7 @@ class CImage is_writable($this->saveFolder) or $this->raiseError('Target directory is not writable.'); - switch(strtolower($this->extension)) { + switch($this->getTargetImageExtension()) { case 'jpeg': case 'jpg': @@ -2138,6 +2127,7 @@ class CImage break; case 'png': + default: $this->Log("Saving image as PNG to cache using compression = {$this->compress}."); // Turn off alpha blending and set alpha flag @@ -2171,20 +2161,17 @@ class CImage $this->Log($res); } break; - - default: - $this->RaiseError('No support for this file extension.'); - break; } if ($this->verbose) { clearstatcache(); - $this->log("Cached image filesize: " . filesize($this->cacheFileName) . " bytes."); - $this->log("imageistruecolor() : " . (imageistruecolor($this->image) ? 'true' : 'false')); - $this->log("imagecolorstotal() : " . imagecolorstotal($this->image)); - $this->log("Number of colors in image = " . $this->ColorsTotal($this->image)); + $this->log("Saved image to cache."); + $this->log(" Cached image filesize: " . filesize($this->cacheFileName) . " bytes."); + $this->log(" imageistruecolor() : " . (imageistruecolor($this->image) ? 'true' : 'false')); + $this->log(" imagecolorstotal() : " . imagecolorstotal($this->image)); + $this->log(" Number of colors in image = " . $this->ColorsTotal($this->image)); $index = imagecolortransparent($this->image); - $this->log("Detected transparent color = " . ($index > 0 ? implode(", ", imagecolorsforindex($this->image, $index)) : "NONE") . " at index = $index"); + $this->log(" Detected transparent color = " . ($index > 0 ? implode(", ", imagecolorsforindex($this->image, $index)) : "NONE") . " at index = $index"); } return $this; @@ -2207,7 +2194,7 @@ class CImage return $this; } - $alias = $alias . "." . $this->extension; + $alias = $alias . "." . $this->getTargetImageExtension(); if (is_readable($alias)) { unlink($alias); @@ -2310,23 +2297,22 @@ class CImage clearstatcache(); - $details['src'] = $this->imageSrc; - $lastModified = filemtime($this->pathToImage); + $details['src'] = $this->imageSrc; + $lastModified = filemtime($this->pathToImage); $details['srcGmdate'] = gmdate("D, d M Y H:i:s", $lastModified); - $details['cache'] = basename($this->cacheFileName); - $lastModified = filemtime($this->cacheFileName); + $details['cache'] = basename($this->cacheFileName); + $lastModified = filemtime($this->cacheFileName); $details['cacheGmdate'] = gmdate("D, d M Y H:i:s", $lastModified); - $this->loadImageDetails($file); - - $details['filename'] = basename($file); - $details['width'] = $this->width; - $details['height'] = $this->height; - $details['aspectRatio'] = round($this->width / $this->height, 3); - $details['size'] = filesize($file); - $this->load($file); + + $details['filename'] = basename($file); + $details['mimeType'] = image_type_to_mime_type($this->fileType); + $details['width'] = $this->width; + $details['height'] = $this->height; + $details['aspectRatio'] = round($this->width / $this->height, 3); + $details['size'] = filesize($file); $details['colors'] = $this->colorsTotal($this->image); $options = null; diff --git a/docs/api/files/CRemoteImage.html b/docs/api/files/CRemoteImage.html index b6164f8..5865ce4 100644 --- a/docs/api/files/CRemoteImage.html +++ b/docs/api/files/CRemoteImage.html @@ -111,7 +111,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -136,10 +136,10 @@
    - + \
    -
    +
    @@ -245,7 +245,7 @@

    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/files/CWhitelist.html b/docs/api/files/CWhitelist.html index 42d5e28..78debed 100644 --- a/docs/api/files/CWhitelist.html +++ b/docs/api/files/CWhitelist.html @@ -111,7 +111,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -136,10 +136,10 @@
    - + \
    -
    +
    @@ -245,7 +245,7 @@

    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/files/autoload.html b/docs/api/files/autoload.html index 7fbdb71..2e8b797 100644 --- a/docs/api/files/autoload.html +++ b/docs/api/files/autoload.html @@ -111,7 +111,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -136,10 +136,10 @@
    - + \
    -
    +
    @@ -238,7 +238,7 @@

    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/files/webroot.img.html b/docs/api/files/webroot.img.html index 147cdc4..c31af3b 100644 --- a/docs/api/files/webroot.img.html +++ b/docs/api/files/webroot.img.html @@ -111,7 +111,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -136,10 +136,10 @@
    - + \
    -
    +
    @@ -506,7 +506,7 @@

    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/files/webroot.img_config.html b/docs/api/files/webroot.img_config.html index 891c4aa..db39911 100644 --- a/docs/api/files/webroot.img_config.html +++ b/docs/api/files/webroot.img_config.html @@ -111,7 +111,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -136,10 +136,10 @@
    - + \
    -
    +
    @@ -240,7 +240,7 @@ config-file imgtest_config.php.


    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/graphs/class.html b/docs/api/graphs/class.html index 4e71faf..92742ff 100644 --- a/docs/api/graphs/class.html +++ b/docs/api/graphs/class.html @@ -88,7 +88,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -152,7 +152,7 @@

    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/index.html b/docs/api/index.html index 4a9bb30..f82fd54 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -63,7 +63,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -88,10 +88,10 @@
    - + \
    -
    +
    @@ -443,7 +443,7 @@

    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/namespaces/default.html b/docs/api/namespaces/default.html index c201673..0444bbd 100644 --- a/docs/api/namespaces/default.html +++ b/docs/api/namespaces/default.html @@ -63,7 +63,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -88,10 +88,10 @@
    - + \
    -
    +
    @@ -443,7 +443,7 @@

    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/phpdoc-cache-7f/phpdoc-cache-file_05104b5f33216f058e4b600e59ccee4e.dat b/docs/api/phpdoc-cache-7f/phpdoc-cache-file_05104b5f33216f058e4b600e59ccee4e.dat index aecc838..bea2538 100644 Binary files a/docs/api/phpdoc-cache-7f/phpdoc-cache-file_05104b5f33216f058e4b600e59ccee4e.dat and b/docs/api/phpdoc-cache-7f/phpdoc-cache-file_05104b5f33216f058e4b600e59ccee4e.dat differ diff --git a/docs/api/reports/deprecated.html b/docs/api/reports/deprecated.html index 97fdd22..f99cc19 100644 --- a/docs/api/reports/deprecated.html +++ b/docs/api/reports/deprecated.html @@ -64,7 +64,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -142,7 +142,7 @@

    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/reports/errors.html b/docs/api/reports/errors.html index 851e2fc..42fc53c 100644 --- a/docs/api/reports/errors.html +++ b/docs/api/reports/errors.html @@ -64,7 +64,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -89,11 +89,11 @@ +
    @@ -103,6 +103,8 @@ +
    +

    @@ -158,12 +160,12 @@ error - 1041 + 1042 Argument $saveAs is missing from the Docblock of setSaveAsExtension() error - 1729 + 1702 Argument $bgColor is missing from the Docblock of rotate() @@ -260,6 +262,8 @@

    +
    +

    @@ -324,10 +328,6 @@

    -
    -
    -
    -
    @@ -367,7 +367,7 @@

    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.
    diff --git a/docs/api/reports/markers.html b/docs/api/reports/markers.html index 407bd00..47a02f2 100644 --- a/docs/api/reports/markers.html +++ b/docs/api/reports/markers.html @@ -64,7 +64,7 @@
  • -  Markers 165 +  Markers 164
  • @@ -88,12 +88,12 @@ @@ -107,594 +107,6 @@
    - -

    - - CRemoteImage.php - 5 -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    TypeLineDescription
    227Save only if body is a valid image
    279First check if the cache is valid and can be used
    290Do a HTTP request to download item
    336Is cache valid?
    344Prepare for a 304 if available
    -
    -
    -
    - -

    - - CImage.php - 94 -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    TypeLineDescription
    6dbwebb.se/opensource/cimage
    7github.com/mosbth/cimage
    86private $bgColorDefault = self::BACKGROUND_COLOR;
    215Calculated from source image
    216Calculated from source image
    223Save original value
    225Save original value
    246Save original value
    310private $remotePattern = '#^[http|https]://#';
    311#';
    335Calculated from source image
    336Calculated from source image
    337Use original image if possible
    572$this->extension = $this->fileExtension;
    603Sanitize filename
    624Options for calculate dimensions
    631array('width'=>null, 'height'=>null, 'start_x'=>0, 'start_y'=>0),
    632'0,0,0,0',
    635Options for caching or using original
    639Pre-processing, before resizing is done
    644General options
    647Post-processing, after resizing is done
    656Output format
    660Options for saving
    661'quality' => null,
    662'compress' => null,
    663'saveAs' => null,
    666Convert crop settings from string to array
    677Convert area settings from string to array
    688Convert filter settings from array of string to array of array
    700php.net/manual/en/function.imagefilter.php'
    708Merge default arguments with incoming and set properties.
    709$args = array_merge_recursive($defaults, $args);
    719Save original values to enable re-calculating
    778Get details on image
    804width as %
    810height as %
    818width & height from aspect ratio
    840Change width & height based on dpr
    852Check values to be within domain
    875Crop, use cropped width and height as base for calulations
    880Check if there is an area to crop off
    897Check if crop is set
    921Calculate new width and height if keeping aspect-ratio.
    926Crop-to-fit and both new width and height are set.
    929Use newWidth and newHeigh as width/height, image should fit in box.
    934Both new width and height are set.
    935Use newWidth and newHeigh as max width/height, image should not be larger.
    945Use new width as max-width
    952Use new height as max-hight
    959Get image dimensions for pre-resize image.
    962Get relations of original & target image
    968Use newWidth and newHeigh as defined width/height,
    969image should fit the area.
    978Use newWidth and newHeigh as defined width/height,
    979image should fit the area.
    989Crop, ensure to set new width and height
    996Fill to fit, ensure to set new width and height
    1003No new height or width is set, use existing measures.
    1444Rotate image
    1451Auto-rotate image
    1458Scale the original image before starting
    1486Only use a specified area of the image, $this->offset is defining the area to use
    1499Do as crop, take only part of image
    1509Consider rewriting the no-upscale code to fit within this if-statement,
    1510likely to be more readable code.
    1511The code is more or leass equal in below crop-to-fit, fill-to-fit and stretch
    1516Resize by crop to fit
    1553Resize by fill to fit
    1562Check ratio for landscape or portrait
    1592Resize it
    1619$this->log("posX=$posX, posY=$posY, cropX=$cropX, cropY=$cropY.");
    1649Rotate image
    1655Apply filters
    1686Convert to palette image
    1692Blur the image
    1698Emboss the image
    1704Sharpen the image
    1710Custom convolution
    1712$this->log("Convolve: " . $this->convolve);
    1791stackoverflow.com/questions/5752514/how-to-convert-png-to-8-bit-png-using-php-gd-library
    1864Check of matching constant
    1872Expect list of 11 numbers, split by , and build up arguments
    1924Use incoming options or use $this.
    1927Treat incoming as string, split by +
    1931Check each option if it matches constant value
    2121Use JPEG optimize if defined
    2143Turn off alpha blending and set alpha flag
    2148Use external program to filter PNG, if defined
    2161Use external program to deflate PNG, if defined
    2257Get image modification time
    2284Get details on image
    TODO383clean up how $this->saveFolder is used in other methods.
    TODO328Clean up these and check if and how they are used
    -
    -
    -
    - -

    - - CHttpGet.php - 1 -

    -
    - - - - - - - - - - - -
    TypeLineDescription
    211max-age=2592000
    -
    -
    -
    - -

    - - autoload.php - 4 -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    TypeLineDescription
    6include __DIR__ . "/../CHttpGet.php";
    7include __DIR__ . "/../CRemoteImage.php";
    8include __DIR__ . "/../CImage.php";
    18$path = CIMAGE_SOURCE_PATH . "/{$class}.php";
    -
    -
    -

    @@ -835,6 +247,530 @@

    +
    +
    + +

    + + CRemoteImage.php + 5 +

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    TypeLineDescription
    227Save only if body is a valid image
    279First check if the cache is valid and can be used
    290Do a HTTP request to download item
    336Is cache valid?
    344Prepare for a 304 if available
    +
    +
    +
    + +

    + + CImage.php + 93 +

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    TypeLineDescription
    6dbwebb.se/opensource/cimage
    7github.com/mosbth/cimage
    86private $bgColorDefault = self::BACKGROUND_COLOR;
    215Calculated from source image
    216Calculated from source image
    223Save original value
    225Save original value
    246Save original value
    310private $remotePattern = '#^[http|https]://#';
    311#';
    335Calculated from source image
    336Calculated from source image
    337Use original image if possible
    603Sanitize filename
    624Options for calculate dimensions
    631array('width'=>null, 'height'=>null, 'start_x'=>0, 'start_y'=>0),
    632'0,0,0,0',
    635Options for caching or using original
    639Pre-processing, before resizing is done
    644General options
    647Post-processing, after resizing is done
    656Output format
    660Options for saving
    661'quality' => null,
    662'compress' => null,
    663'saveAs' => null,
    666Convert crop settings from string to array
    677Convert area settings from string to array
    688Convert filter settings from array of string to array of array
    700php.net/manual/en/function.imagefilter.php'
    708Merge default arguments with incoming and set properties.
    709$args = array_merge_recursive($defaults, $args);
    719Save original values to enable re-calculating
    778Get details on image
    805width as %
    811height as %
    819width & height from aspect ratio
    841Change width & height based on dpr
    853Check values to be within domain
    876Crop, use cropped width and height as base for calulations
    881Check if there is an area to crop off
    898Check if crop is set
    922Calculate new width and height if keeping aspect-ratio.
    927Crop-to-fit and both new width and height are set.
    930Use newWidth and newHeigh as width/height, image should fit in box.
    935Both new width and height are set.
    936Use newWidth and newHeigh as max width/height, image should not be larger.
    946Use new width as max-width
    953Use new height as max-hight
    960Get image dimensions for pre-resize image.
    963Get relations of original & target image
    969Use newWidth and newHeigh as defined width/height,
    970image should fit the area.
    979Use newWidth and newHeigh as defined width/height,
    980image should fit the area.
    990Crop, ensure to set new width and height
    997Fill to fit, ensure to set new width and height
    1004No new height or width is set, use existing measures.
    1417Rotate image
    1424Auto-rotate image
    1431Scale the original image before starting
    1459Only use a specified area of the image, $this->offset is defining the area to use
    1472Do as crop, take only part of image
    1482Consider rewriting the no-upscale code to fit within this if-statement,
    1483likely to be more readable code.
    1484The code is more or leass equal in below crop-to-fit, fill-to-fit and stretch
    1489Resize by crop to fit
    1526Resize by fill to fit
    1535Check ratio for landscape or portrait
    1565Resize it
    1592$this->log("posX=$posX, posY=$posY, cropX=$cropX, cropY=$cropY.");
    1622Rotate image
    1628Apply filters
    1659Convert to palette image
    1665Blur the image
    1671Emboss the image
    1677Sharpen the image
    1683Custom convolution
    1685$this->log("Convolve: " . $this->convolve);
    1764stackoverflow.com/questions/5752514/how-to-convert-png-to-8-bit-png-using-php-gd-library
    1837Check of matching constant
    1845Expect list of 11 numbers, split by , and build up arguments
    1897Use incoming options or use $this.
    1900Treat incoming as string, split by +
    1904Check each option if it matches constant value
    2110Use JPEG optimize if defined
    2133Turn off alpha blending and set alpha flag
    2138Use external program to filter PNG, if defined
    2151Use external program to deflate PNG, if defined
    2244Get image modification time
    2271Get details on image
    TODO383clean up how $this->saveFolder is used in other methods.
    TODO328Clean up these and check if and how they are used
    +
    @@ -1032,6 +968,65 @@
    + +
    + +

    + + CHttpGet.php + 1 +

    +
    + + + + + + + + + + + +
    TypeLineDescription
    211max-age=2592000
    +
    +
    +
    + +

    + + autoload.php + 4 +

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    TypeLineDescription
    6include __DIR__ . "/../CHttpGet.php";
    7include __DIR__ . "/../CRemoteImage.php";
    8include __DIR__ . "/../CImage.php";
    18$path = CIMAGE_SOURCE_PATH . "/{$class}.php";
    +
    @@ -1073,7 +1068,7 @@

    Documentation is powered by phpDocumentor and authored - on March 4th, 2015 at 10:52. + on March 6th, 2015 at 12:38.