0.9.0 - the ZapV version updated to current php standards. Brave search used, while Bing and Google search api are deprecated
This commit is contained in:
parent
3d4298fe8b
commit
4ddaddda3d
31 changed files with 1778 additions and 1 deletions
50
lib/ImgIOTools.class.php
Executable file
50
lib/ImgIOTools.class.php
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* Image Input Output Tools
|
||||
*/
|
||||
class ImgIOTools {
|
||||
public static $maxScreenWidth = 1067; //screen dimensions
|
||||
|
||||
public static $maxScreenHeight = 600;
|
||||
|
||||
/**
|
||||
* Flushes image to screen
|
||||
* @param Imagick $im
|
||||
* @return void
|
||||
*/
|
||||
public static function onScreen(Imagick $img) {
|
||||
$img->scaleImage(self::$maxScreenWidth, self::$maxScreenHeight, true);
|
||||
|
||||
//$img = self::scaleByLength($img, $this->maxScreenWidth, $this->maxScreenHeight);
|
||||
header('Content-type: image/' . ZAP_IMG_TYPE);
|
||||
echo $img->getImageBlob();
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts image from $imgUrl (if exists) onscreen
|
||||
* @param string $imgUrl
|
||||
* @return boolean or imagedata
|
||||
*/
|
||||
public static function urlOnScreen($imgUrl) {
|
||||
if (file_exists($imgUrl)) {
|
||||
$img = new Imagick($imgUrl);
|
||||
self::onScreen($img);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves active image from $im as $filename.$filetype in $folder
|
||||
* @param Imagick $im
|
||||
* @param string $folder
|
||||
* @param string $filename
|
||||
* @param string $filetype
|
||||
* @return boolean
|
||||
*/
|
||||
public static function saveImg(Imagick $img, $folder, $filename) {
|
||||
$path = $folder . $filename . '.' . ZAP_IMG_TYPE;
|
||||
return $img->writeImage($path);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue