function resizeImage(&$image, $newWidth, $newHeight) { if (!isset($image) || !isset($newWidth) && !isset($newHeight)) { return false; } $image = scaleImage($image, $newWidth, $newHeight); }
function Imagen__CrearMiniatura($Origen, $Destino, $Ancho = 100, $Alto = 100) { $im = new Imagick($Origen); $im->setImageColorspace(255); $im->setCompression(Imagick::COMPRESSION_JPEG); $im->setCompressionQuality(80); $im->setImageFormat('jpeg'); list($newX, $newY) = scaleImage($im->getImageWidth(), $im->getImageHeight(), $Ancho, $Alto); $im->thumbnailImage($newX, $newY, false); return $im->writeImage($Destino); }
function check_number($number, $complement = '') { global $CACHE_DIR; global $PICTURES_DIR; global $BLOWUP; # Not found by default $return = False; # Look in the cache directory $filename = $CACHE_DIR . '/' . $number . '.png'; if (file_exists($filename)) { # Retrieve image $im = @imagecreatefrompng($filename); # Modify image if needed if ($complement != '') { $im = customImage($im, $complement); } # Send image in the HTTP response header('Content-type: image/png'); imagepng($im); # Destroy image imagedestroy($im); # Found $return = True; } # Not found if (!$return) { # Look in the cache $im = getImageFromLibrary($PICTURES_DIR, $number); # Image found if (!empty($im)) { # Found $return = True; # Scale image to 150x200 pixel $im = scaleImage($im, $BLOWUP); # Save image to cache directory. use same number in filename as in original file in the library. $filename = $CACHE_DIR . '/' . $number . '.png'; @imagepng($im, $filename); # Modify image if needed if ($complement != '') { $im = customImage($im, $complement); } # Send image in the HTTP response header('Content-type: image/png'); imagepng($im); # Destroy image imagedestroy($im); } } # Return result return $return; }
if ($trashmail_check) { die($trashmail_check); } switch ($data["task"]) { case "validate": $mydebug .= "\n\rvalidate"; print json_encode(validate_meldung_in_aoi($data["point"])); break; case "submit": $mydebug .= "\n\rvalidate"; if (validate_meldung_in_aoi($data["point"])) { $backend_data = array("typ" => $data["typ"], "kategorie" => $data["unterkategorie"] ? $data["unterkategorie"] : $data["hauptkategorie"], "oviWkt" => $data["point"], "autorEmail" => $data["email"], "betreff" => $data["betreff"], "details" => $data["details"]); $origImgPath = $data["foto"]["tmp_name"]; $imgInfo = pathinfo($data['foto']['name']); if ($data['foto'] != NULL && $data['foto']['name'] !== '' && !in_array(strtolower($imgInfo['extension']), array('jpg', 'jpeg', 'png', 'gif'))) { die("1110#1110#Der Dateityp des Fotos wurde nicht erkannt."); } $scaledImgPath = scaleImage($origImgPath, 720, 720); $fh = fopen($scaledImgPath, "r"); if ($fh) { $fd = fread($fh, filesize($scaledImgPath)); $fd_base64 = base64_encode($fd); $backend_data["bild"] = $fd_base64; } relay($backend_data, "vorgang"); } else { header('Content-type: text/html; charset=utf-8'); print "1002#1002#Die neue Meldung befindet sich außerhalb Rostocks."; } break; }