Watermark op een GIF?

Gestart doorMounssif8 reacties60 weergaven

9 berichten · pagina 1 van 1

Mounssif

Lid · Topicstarter

Berichten
1.284
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
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 (
Afbeelding niet beschikbaarDe oorspronkelijke afbeelding of link ontbreekt.
Mijn code:
Spoiler tonen
Codeblok (voorbeeld.php):
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.";
}
}

?>
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
De GD-lib heeft geen ondersteuning voor GIF-plaatjes met frames.

met Imagemagick zou dit wel moeten kunnen. Het is wel te hopen dat je hosting het ondersteunt.

[COLOR= #0000BB]<?php
$animation[/COLOR] [COLOR= #007700]=[/COLOR] ani[COLOR= #007700].[/COLOR]gif[COLOR= #007700];[/COLOR] 
[COLOR= #0000BB]$watermark[/COLOR] [COLOR= #007700]=[/COLOR] logo[COLOR= #007700].[/COLOR]png[COLOR= #007700];[/COLOR] 

[COLOR= #0000BB]$watermarked_animation[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"morph.gif"[/COLOR][COLOR= #007700];[/COLOR] 
[COLOR= #0000BB]$cmd[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]" $animation -coalesce -gravity South "[/COLOR][COLOR= #007700].[/COLOR] 
[COLOR= #DD0000]" -geometry +0+0 null: $watermark -layers composite -layers optimize "[/COLOR][COLOR= #007700];[/COLOR] 
[URL="http://www.php.net/exec"]exec[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"convert $cmd $watermarked_animation "[/COLOR][COLOR= #007700]);[/COLOR] 
?>
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
De GD-lib heeft geen ondersteuning voor GIF-plaatjes met frames.

met Imagemagick zou dit wel moeten kunnen. Het is wel te hopen dat je hosting het ondersteunt.
[COLOR= #0000BB]<?php
$animation[/COLOR] [COLOR= #007700]=[/COLOR] ani[COLOR= #007700].[/COLOR]gif[COLOR= #007700];[/COLOR] 
[COLOR= #0000BB]$watermark[/COLOR] [COLOR= #007700]=[/COLOR] logo[COLOR= #007700].[/COLOR]png[COLOR= #007700];[/COLOR] 

[COLOR= #0000BB]$watermarked_animation[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"morph.gif"[/COLOR][COLOR= #007700];[/COLOR] 
[COLOR= #0000BB]$cmd[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]" $animation -coalesce -gravity South "[/COLOR][COLOR= #007700].[/COLOR] 
[COLOR= #DD0000]" -geometry +0+0 null: $watermark -layers composite -layers optimize "[/COLOR][COLOR= #007700];[/COLOR] 
[URL="http://www.php.net/exec"]exec[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"convert $cmd $watermarked_animation "[/COLOR][COLOR= #007700]);[/COLOR] 
?>


[func]exec[/func] is meestal uitgeschakeld op hosts.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Jponsen schreef:
Eerdere citaten tonen
Aarclay schreef:
De GD-lib heeft geen ondersteuning voor GIF-plaatjes met frames.
met Imagemagick zou dit wel moeten kunnen. Het is wel te hopen dat je hosting het ondersteunt.

[COLOR= #0000BB]<?php
$animation[/COLOR] [COLOR= #007700]=[/COLOR] ani[COLOR= #007700].[/COLOR]gif[COLOR= #007700];[/COLOR] 
[COLOR= #0000BB]$watermark[/COLOR] [COLOR= #007700]=[/COLOR] logo[COLOR= #007700].[/COLOR]png[COLOR= #007700];[/COLOR] 

[COLOR= #0000BB]$watermarked_animation[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"morph.gif"[/COLOR][COLOR= #007700];[/COLOR] 
[COLOR= #0000BB]$cmd[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]" $animation -coalesce -gravity South "[/COLOR][COLOR= #007700].[/COLOR] 
[COLOR= #DD0000]" -geometry +0+0 null: $watermark -layers composite -layers optimize "[/COLOR][COLOR= #007700];[/COLOR] 
[URL="http://www.php.net/exec"]exec[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"convert $cmd $watermarked_animation "[/COLOR][COLOR= #007700]);[/COLOR] 
?>

[func]exec[/func] is meestal uitgeschakeld op hosts.

Ja, meestal ja, maar niet altijd.
0
Mounssif

Lid · Topicstarter

Berichten
1.284
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja op one2xs zijn ze uitgeschakeld helaas..
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Mounssif schreef:
Ja op one2xs zijn ze uitgeschakeld helaas..
Begrijpelijk, maar ik neem aan dat als je weet wat je doet, dat deze dan aan kunnen worden gezet d.m.v. een ticket.

Dan is het nog wel de vraag of Imagemagick geinstalleerd is.
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Het is algemeen bekend dat je best geen exec gebruikt met php
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Hoe moet je dan commandlinecommandos uitvoeren?
Cron?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Aarclay schreef:
Hoe moet je dan commandlinecommandos uitvoeren?
Cron?
Een library en geen command line apps uitvoeren.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren