Exemplo n.º 1
0
    if (array_key_exists("tmpId", $_REQUEST)) {
        $image = TempImage::loadById($_REQUEST["tmpId"]);
    }
    if ($image === null) {
        /* The image is still null - output an "image not found" image.	 */
        ImageRenderer::outputRenderNotFoundImage($_REQUEST["w"], $_REQUEST["h"]);
        exit;
    }
}
$mode = "fit";
if (array_key_exists("m", $_REQUEST)) {
    $mode = $_REQUEST["m"];
}
if (array_key_exists("cache", $_REQUEST)) {
    if ($_REQUEST["cache"] == "false") {
        CachedImage::invalidate($image);
    }
}
switch ($mode) {
    case "fitpadding":
        $file = $image->fitWithinPadding($_REQUEST["w"], $_REQUEST["h"]);
        break;
    case "fitexact":
        $file = $image->fitWithinExact($_REQUEST["w"], $_REQUEST["h"]);
        break;
    case "scale":
        $file = $image->scaleTo($_REQUEST["w"], $_REQUEST["h"]);
        break;
    case "fit":
    default:
        $file = $image->fitWithin($_REQUEST["w"], $_REQUEST["h"]);
Exemplo n.º 2
0
 /**
  * Replaces the current image with a new image.
  * 
  * Automatically converts from one format to PNG,
  * which is the default when dealing with images
  * on the platform.
  * 
  * @param string $path	The path to the original image
  */
 public function replace($path)
 {
     parent::replace($path);
     CachedImage::invalidate($this);
 }