Skip to content

Instantly share code, notes, and snippets.

@xombra
Created April 26, 2014 03:13
Show Gist options
  • Save xombra/11310827 to your computer and use it in GitHub Desktop.
Save xombra/11310827 to your computer and use it in GitHub Desktop.
Marca de Agua
$imagen = 'images/img_promos/'.$_GET["imagen"];
$imagen = imagecreatefromjpeg($imagen);
$marca = imagecreatefrompng('images/promo.jpg');
$destino_x = imagesx($imagen);
$destino_y = imagesy($imagen);
$medi_marca_y = imagesy($marca);
$medi_marca_x = imagesx($marca);
$dest_y = 540;
$dest_x = 960;
$calidad = 72;
imagecopy($imagen, $marca, $dest_x, $dest_y, 0, 0, $medi_marca_x, $medi_marca_y);
header("Content-type: image/jpeg");
header('Content-Transfer-Encoding: binary');
header("Pragma: public");
header("Cache-Control: cache");
header("Pragma: cache");
ob_clean();
imagejpeg($imagen,NULL,$calidad);
flush();
imagedestroy($imagen);
imagedestroy($marca);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment