zapWidth and zapHeight are now in conf.php (#21)
This commit is contained in:
parent
9196bf07a7
commit
e96b8e5563
4 changed files with 9 additions and 14 deletions
|
|
@ -6,6 +6,9 @@
|
||||||
define('MAX_WORDS', 4);
|
define('MAX_WORDS', 4);
|
||||||
define('MAX_ZAPS', 9);
|
define('MAX_ZAPS', 9);
|
||||||
|
|
||||||
|
define('ZAP_DEFAULT_WIDTH', 1067);
|
||||||
|
define('ZAP_DEFAULT_HEIGHT', 600);
|
||||||
|
|
||||||
define('ZAP_CURL_TIMEOUT', 12);
|
define('ZAP_CURL_TIMEOUT', 12);
|
||||||
define('ZAP_IMG_TYPE', 'jpg');
|
define('ZAP_IMG_TYPE', 'jpg');
|
||||||
define('ZAP_CANVAS_NAME', 'collage');
|
define('ZAP_CANVAS_NAME', 'collage');
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,6 @@
|
||||||
* Image Input Output Tools
|
* Image Input Output Tools
|
||||||
*/
|
*/
|
||||||
class ImgIOTools {
|
class ImgIOTools {
|
||||||
public static $maxScreenWidth = 1067; //screen dimensions
|
|
||||||
|
|
||||||
public static $maxScreenHeight = 600;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flushes image to screen
|
* Flushes image to screen
|
||||||
|
|
@ -13,9 +10,9 @@ class ImgIOTools {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function onScreen(Imagick $img) {
|
public static function onScreen(Imagick $img) {
|
||||||
$img->scaleImage(self::$maxScreenWidth, self::$maxScreenHeight, true);
|
$img->scaleImage(ZAP_DEFAULT_WIDTH, ZAP_DEFAULT_HEIGHT, true);
|
||||||
|
|
||||||
//$img = self::scaleByLength($img, $this->maxScreenWidth, $this->maxScreenHeight);
|
//$img = self::scaleByLength($img, ZAP_DEFAULT_WIDTH, ZAP_DEFAULT_HEIGHT);
|
||||||
header('Content-type: image/' . ZAP_IMG_TYPE);
|
header('Content-type: image/' . ZAP_IMG_TYPE);
|
||||||
echo $img->getImageBlob();
|
echo $img->getImageBlob();
|
||||||
}
|
}
|
||||||
|
|
@ -46,5 +43,4 @@ class ImgIOTools {
|
||||||
$path = $folder . $filename . '.' . ZAP_IMG_TYPE;
|
$path = $folder . $filename . '.' . ZAP_IMG_TYPE;
|
||||||
return $img->writeImage($path);
|
return $img->writeImage($path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
@ -3,10 +3,6 @@
|
||||||
* Library of tool functions to manipulate an image
|
* Library of tool functions to manipulate an image
|
||||||
*/
|
*/
|
||||||
class ImgTools {
|
class ImgTools {
|
||||||
public static $maxScreenWidth = 1067; //screen dimensions
|
|
||||||
|
|
||||||
public static $maxScreenHeight = 600;
|
|
||||||
|
|
||||||
public static $minFuzzFactor = 0.08; //minimal factor for $fuzz
|
public static $minFuzzFactor = 0.08; //minimal factor for $fuzz
|
||||||
|
|
||||||
public static $maxFuzzFactor = 0.64; //maximal factor for $fuzz
|
public static $maxFuzzFactor = 0.64; //maximal factor for $fuzz
|
||||||
|
|
@ -161,7 +157,7 @@ class ImgTools {
|
||||||
public static function scaleByLength(Imagick $img, $maxW, $maxH) {
|
public static function scaleByLength(Imagick $img, $maxW, $maxH) {
|
||||||
$width = $img->getImageWidth();
|
$width = $img->getImageWidth();
|
||||||
$height = $img->getImageHeight();
|
$height = $img->getImageHeight();
|
||||||
if(($width <= self::$maxScreenWidth) && ($height <= self::$maxScreenHeight)) {
|
if(($width <= ZAP_DEFAULT_WIDTH) && ($height <= ZAP_DEFAULT_HEIGHT)) {
|
||||||
return $img;
|
return $img;
|
||||||
} else {
|
} else {
|
||||||
if ($width >= $height) { //horizontal image
|
if ($width >= $height) { //horizontal image
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,10 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="inp">
|
<div class="inp">
|
||||||
width <input type="text" name="width" id="width" size="5" maxlength="4" value="1067"> px
|
width <input type="text" name="width" id="width" size="5" maxlength="4" value="<?= ZAP_DEFAULT_WIDTH ?>"> px
|
||||||
</div>
|
</div>
|
||||||
<div class="inp">
|
<div class="inp">
|
||||||
height <input type="text" name="height" id="height" size="5" maxlength="4" value="600"> px
|
height <input type="text" name="height" id="height" size="5" maxlength="4" value="<?= ZAP_DEFAULT_HEIGHT ?>"> px
|
||||||
</div>
|
</div>
|
||||||
<div class="inp">
|
<div class="inp">
|
||||||
<input type="button" class="btn" onclick="form1Submit()" value="Go & Generate Some Zaps">
|
<input type="button" class="btn" onclick="form1Submit()" value="Go & Generate Some Zaps">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue