Jump to content

Problem with watermark on uploaded pictures


Recommended Posts

I'm working at a script to place a watermark on uploaded pictures.

The uploading is working very well. But I can't place a watermark on it. The script finds the watermark without a problem and if I call it somewhere in the script, it can be shown. But when I do the same with the image, it tells me that it's an array? Is this normal? Does someone find my errors in the script perhaps?

 

Here is the watermark and uploading part of my script:

 

$dir = "./Foto/$maker/$jaar";
$path_watermerk = "./Copyrights/$water";

if (file_exists($dir))
{
echo "Jaar <b>$jaar</b> bestond reeds en diende niet aangemaakt te worden!<BR/>";
mkdir("$dir/$map", 0755);
echo "Map: <b>$map</b> is succesvol aangemaakt!<BR/><BR/>";

$dir2 = "./Foto/$maker/$jaar/$map";


for ($i = 1, $j = 0; $i <= $aantal; $i++, $j++)
	{			
    			$k = 0;
		$k= "$dir2/".$_FILES ['ufile']['name'][$j];

		$chmod = $_FILES ['ufile']['name'][$j];
		copy($_FILES ['ufile']['tmp_name'][$j], $k);

		$watermerk = imagecreatefrompng($path_watermerk);
		$watermerk_width = imagesx($watermerk);
		$watermerk_height = imagesy($watermerk);
		imagecreatetruecolor($watermerk_width, $watermerk_height);

		$image = imagecreatefromjpeg($k);
		$size = getimagesize($k);

		$xas = $size[0] - $watermerk_width - 5;
		$yas = 5;

		imagecopymerge($image, $watermerk, $xas, $yas, 0, 0, $watermerk_width, $watermerk_height, 100);

		imagejpeg($image, $k);


		echo "Foto $i is succesvol geupload!<BR/>";
	}

}
else 
{
$dir = "./Foto/$maker";
mkdir("$dir/$jaar", 0755);
echo "Jaar <b>$jaar</b> bestond nog niet en is succesvol aangemaakt<BR/>";
mkdir("./Foto/$maker/$jaar/$map", 0755);
echo "Map: <b>$map</b> is succesvol aangemaakt!<BR/><BR/>";

$dir2 = "./Foto/$maker/$jaar/$map";

for ($i = 1, $j = 0; $i <= $aantal; $i++, $j++)
	{
	$k = 0;
		$k= "$dir2/".$_FILES ['ufile']['name'][$j];

		$chmod = $_FILES ['ufile']['name'][$j];
		copy($_FILES ['ufile']['tmp_name'][$j], $k);

		$watermerk = imagecreatefrompng($path_watermerk);
		$watermerk_width = imagesx($watermerk);
		$watermerk_height = imagesy($watermerk);
		imagecreatetruecolor($watermerk_width, $watermerk_height);

		$image = imagecreatefromjpeg($k);
		$size = getimagesize($k);

		$xas = $size[0] - $watermerk_width - 5;
		$yas = 5;

		imagecopymerge($image, $watermerk, $xas, $yas, 0, 0, $watermerk_width, $watermerk_height, 100);

		imagejpeg($image, $k);


		echo "Foto $i is succesvol geupload!<BR/>";

	}
}

 

Thanks if you can help me out with this one.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.