Example #1
0
 *******************/
error_reporting(E_ALL);
ini_set('display_errors', '1');
date_default_timezone_set('UTC');
require_once '../../vendor/autoload.php';
use Elboletaire\Watimage\Watimage;
function flipImage($image, $mode, $output_image)
{
    $wm = new Watimage();
    $wm->setImage(array('file' => "files/{$image}", 'quality' => 90));
    // file to use and export quality
    $wm->flip($mode);
    if (!$wm->generate("results/{$output_image}")) {
        // handle errors...
        print_r($wm->errors);
    }
}
// Flip horizontally
flipImage('image.jpg', 'horizontal', 'flip_jpg_horizontally.jpg');
// Flip vertically
flipImage('image.jpg', 'vertical', 'flip_jpg_vertically.jpg');
// Flip on both axis
flipImage('image.jpg', 'both', 'flip_jpg_both.jpg');
############################
### Check transparencies ###
############################
// Flip a png image
flipImage('image.png', 'horizontal', 'flip_png_horizontally.png');
// Flip a gif image.
flipImage('image.gif', 'horizontal', 'flip_gif_horizontally.gif');
echo "All images have been flipped.\n";
Example #2
0
    }
} else {
    $layer = $mapa->getlayerbyname($temaz);
    $layer->set("status", MS_DEFAULT);
    $eb = $mapa->scalebar;
    $eb->set("status", MS_OFF);
}
$cor = $mapa->imagecolor;
$cor->setRGB(255, 255, 255);
$imgo = $mapa->draw();
$nome = $imgo->imagepath . nomeRandomico() . ".png";
$nomefinal = $imgo->imagepath . nomeRandomico() . ".wrl";
$imgo->saveImage($nome);
$arquivoalt = $nome;
$imgcor = imagecreatefrompng($arquivocor);
$imgcor = flipImage($imgcor, true, false);
imagepng($imgcor, $arquivocor);
$imgalt = imagecreatefrompng($arquivoalt);
$sx = imagesx($imgalt);
$sy = imagesy($imgalt);
$fp = fopen($nomefinal, "w");
$texto = "#VRML V2.0 utf8\r\nGroup {\r\nchildren [DirectionalLight { direction 0 -1 0 }\r\nShape {\r\nappearance Appearance {\r\n\tmaterial Material { diffuseColor .2 .2 .2 }";
$texto .= "texture ImageTexture { url " . '"' . basename($arquivocor) . '"';
$texto .= "}\r\n}\r\n\r\n  geometry ElevationGrid {\r\n\txDimension {$sx}\r\n\txSpacing 1\r\n\tzDimension {$sy}\r\n\tzSpacing 1\r\n\tsolid TRUE\r\nheight [\n";
fwrite($fp, $texto);
//fator redução de z
if ($fz == "" || $fz == 0) {
    $fz = 1;
}
for ($y = 0; $y < $sy; $y++) {
    for ($x = 0; $x < $sx; $x++) {