Hey!

I am currently trying to make rounded edges with php, by using PNG pictures and imagecopymerge()-ing them on top of the picture I want rounded corners on.

So I've looked up a code :

http://www.assemblysys.com/dataServi...dedCorners.php

And I've made some small changes to it :

Code:
<?php
$corner_radius = 4; // The default corner radius is set to 4px
$angle = 0; // The default angle is set to 0
$topleft = true; // Top-left rounded corner is shown by default
$bottomleft = true; // Bottom-left rounded corner is shown by default
$bottomright = true; // Bottom-right rounded corner is shown by default
$topright = true; // Top-right rounded corner is shown by default

$images_dir = 'images/';
$corner_source = imagecreatefrompng('images/corner.png');

$corner_width = imagesx($corner_source);  
$corner_height = imagesy($corner_source);  
$corner_resized = imagecreatetruecolor($corner_radius, $corner_radius);
imagecopyresampled($corner_resized, $corner_source, 0, 0, 0, 0, $corner_radius, $corner_radius, $corner_width, $corner_height);

$corner_width = imagesx($corner_resized);  
$corner_height = imagesy($corner_resized);  
$image = imagecreatetruecolor($corner_width, $corner_height);

if($thumblastname == "jpg") {
	$image = imagecreatefromjpeg($images_dir . $image_file); // replace filename with $_GET['src']
}

if ($thumblastname == "gif") {
	$image = imagecreatefromgif($images_dir . $image_file); // replace filename with $_GET['src']
}

if ($thumblastname == "png") {
	$image = imagecreatefrompng($images_dir . $image_file); // replace filename with $_GET['src']
}

$size = getimagesize($images_dir . $image_file); // replace filename with $_GET['src'] 
$white = imagecolorallocate($image,255,255,255);
$black = imagecolorallocate($image,0,0,0);

// Top-left corner
if ($topleft == true) {
	$dest_x = 0;  
	$dest_y = 0;  
	imagecolortransparent($corner_resized, $black);
	imagealphablending($corner_resized, false);
	imagecopymerge($image, $corner_resized, $dest_x, $dest_y, 0, 0, $corner_width, $corner_height, 100);
} 

// Bottom-left corner
if ($bottomleft == true) {
	$dest_x = 0;  
	$dest_y = $size[1] - $corner_height; 
	$rotated = imagerotate($corner_resized, 90, 0);
	imagecolortransparent($rotated, $black);
	imagealphablending($rotated, false);
	imagecopymerge($image, $rotated, $dest_x, $dest_y, 0, 0, $corner_width, $corner_height, 100);  
}

// Bottom-right corner
if ($bottomright == true) {
	$dest_x = $size[0] - $corner_width;  
	$dest_y = $size[1] - $corner_height;  
	$rotated = imagerotate($corner_resized, 180, 0);
	imagecolortransparent($rotated, $black);
	imagealphablending($rotated, false);
	imagecopymerge($image, $rotated, $dest_x, $dest_y, 0, 0, $corner_width, $corner_height, 100);  
}

// Top-right corner
if ($topright == true) {
	$dest_x = $size[0] - $corner_width;  
	$dest_y = 0;  
	$rotated = imagerotate($corner_resized, 270, 0);
	imagecolortransparent($rotated, $black);
	imagealphablending($rotated, false);
	imagecopymerge($image, $rotated, $dest_x, $dest_y, 0, 0, $corner_width, $corner_height, 100);  
}

// Output final image
if(imagepng($image, $thumb_path)) {
	echo("Success!");
}

imagedestroy($image);  
imagedestroy($corner_source);
?>
But what I get is horribly ugly rounded corners, with a Black line on the rounded part. (A black edge on the corners)

Example picture:
http://www.previewx.se/upload/upload...2152153179.jpg

Why is this?

Is there a easy solution for my problem?

Cheers,
Artheus