Hallo,
Ik vroeg me af hoe ik een Watermark zet op een bewegende plaatje.. Ik probeerde het maar ik kreeg een stilstaande foto met watermark ( 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$image_path = "watermark.png";
function watermark_image($oldimage_name, $new_image_name){
global $image_path;
list($owidth,$oheight) = getimagesize($oldimage_name);
$width = $owidth;
$height = $oheight;
$im = imagecreatetruecolor($width, $height);
$img_src = imagecreatefromjpeg($oldimage_name);
imagecopyresampled($im, $img_src, 0, 0, 0, 0, $width, $height, $owidth, $oheight);
$watermark = imagecreatefrompng($image_path);
list($w_width, $w_height) = getimagesize($image_path);
$pos_x = $width - $w_width;
$pos_y = $height - $w_height;
imagecopy($im, $watermark, $pos_x, $pos_y, 0, 0, $w_width, $w_height);
imagejpeg($im, $new_image_name, 100);
imagedestroy($im);
unlink($oldimage_name);
return true;
}
$demo_image= "";
if(isset($_POST[createmark]) and $_POST[createmark] == "Submit"){
$path = "uploads/";
$valid_formats = array("gif");
$name = $_FILES[imgfile][name];
if(strlen($name))
{
list($txt, $ext) = explode(".", $name);
if(in_array($ext,$valid_formats)&& $_FILES[imgfile][size] <= 8000*80000)
{
$upload_status = move_uploaded_file($_FILES[imgfile][tmp_name], $path.$_FILES[imgfile][name]);
if($upload_status){
$new_name = $path.date(l jS of F Y h:i:s A).".jpg";
if(watermark_image($path.$_FILES[imgfile][name], $new_name))
$demo_image = $new_name;
}
}
else
$msg="Oeps, er is een fout opgetreden.";
}
}
?>
Ik vroeg me af hoe ik een Watermark zet op een bewegende plaatje.. Ik probeerde het maar ik kreeg een stilstaande foto met watermark (
Afbeelding niet beschikbaarDe oorspronkelijke afbeelding of link ontbreekt.
Mijn code:Spoiler tonen
Codeblok (voorbeeld.php):
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$image_path = "watermark.png";
function watermark_image($oldimage_name, $new_image_name){
global $image_path;
list($owidth,$oheight) = getimagesize($oldimage_name);
$width = $owidth;
$height = $oheight;
$im = imagecreatetruecolor($width, $height);
$img_src = imagecreatefromjpeg($oldimage_name);
imagecopyresampled($im, $img_src, 0, 0, 0, 0, $width, $height, $owidth, $oheight);
$watermark = imagecreatefrompng($image_path);
list($w_width, $w_height) = getimagesize($image_path);
$pos_x = $width - $w_width;
$pos_y = $height - $w_height;
imagecopy($im, $watermark, $pos_x, $pos_y, 0, 0, $w_width, $w_height);
imagejpeg($im, $new_image_name, 100);
imagedestroy($im);
unlink($oldimage_name);
return true;
}
$demo_image= "";
if(isset($_POST[createmark]) and $_POST[createmark] == "Submit"){
$path = "uploads/";
$valid_formats = array("gif");
$name = $_FILES[imgfile][name];
if(strlen($name))
{
list($txt, $ext) = explode(".", $name);
if(in_array($ext,$valid_formats)&& $_FILES[imgfile][size] <= 8000*80000)
{
$upload_status = move_uploaded_file($_FILES[imgfile][tmp_name], $path.$_FILES[imgfile][name]);
if($upload_status){
$new_name = $path.date(l jS of F Y h:i:s A).".jpg";
if(watermark_image($path.$_FILES[imgfile][name], $new_name))
$demo_image = $new_name;
}
}
else
$msg="Oeps, er is een fout opgetreden.";
}
}
?>