Created
April 16, 2011 13:02
-
-
Save Quirkylee/923098 to your computer and use it in GitHub Desktop.
I want to place the watermark at the bottom of the original image and resize the watermark so it fits in the original image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require("inc/core.php"); | |
$row = $db->query("SELECT type,original FROM photos WHERE id =".$_GET['i']); | |
$row = $row->fetch_assoc(); | |
$loc = $row['original']; | |
if($type == "image/jpeg") { | |
echo $row['original']; | |
//header('content-type: image/jpeg'); | |
$watermark = imagecreatefrompng('images/watermark.png'); | |
$watermark_width = imagesx($watermark); | |
$watermark_height = imagesy($watermark); | |
$image = imagecreatetruecolor($watermark_width, $watermark_height); | |
$image = imagecreatefromjpeg($loc); | |
$size = getimagesize($loc); | |
$dest_x = $size[0] - $watermark_width - 5; | |
$dest_y = $size[1] - $watermark_height - 5; | |
imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); | |
//imagejpeg($image); | |
imagedestroy($image); | |
imagedestroy($watermark); | |
} elseif($type == "image/gif") { | |
} elseif($type == "image/png") { | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment