Example #1
0
<?php

$error = null;
try {
    if (isset($_FILES['Image'])) {
        $ext = strtolower(pathinfo($_FILES['Image']['name'], PATHINFO_EXTENSION));
        if (!in_array($ext, array('png', 'jpg', 'bmp', 'jpeg', 'gif'))) {
            throw new Exception('Formato de imagem inválido');
        }
        require_once "./canvas.php";
        $canvas = new canvas();
        $canvas->carrega($_FILES['Image']['tmp_name']);
        $canvas->redimensiona(400, 400, 'crop');
        $canvas->marca('minas.png', 'topo', 'esquerda');
        $canvas->grava();
        exit;
    }
} catch (Exception $e) {
    $error = $e->getMessage();
}
?>
<!DOCTYPE html>
<html lang="pt-br">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="description" content="">
		<meta name="author" content="">

		<title>Mariana - Minas Gerais</title>