[PHP] Watermerk script, afbeelding opslaan

Gestart doorMarvinn2 reacties46 weergaven

3 berichten · pagina 1 van 1

Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoi,

Ik heb dit script ergens van internet afgeplukt en het werkt prima.

Alleen heb ik het volgende probleem ik, ik laat de afbeelding zo zien:
afbeelding_weergeven.php

<img WIDTH=300 HEIGHT=200 class=beacon src=http://URL.nl/watermerk.php?datum=".$_GET[dag]."&img=$file/>


Als ik dan het plaatje wil opslaan krijgt de afbeelding de bestandsnaam watermerk.php. Hoe kan ik zorgen dat de bestandsnaam gewoon img_2389.jpg wordt oid? Dit script is voor privé gebruik dus bezoekers zien het niet.

En de code van het watermerk:
watermerk.php

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// Load the stamp and the photo to apply the watermark to[/COLOR]
[COLOR= #0000BB]$stamp[/COLOR] [COLOR= #007700]=[/COLOR] imagecreatefrompng[COLOR= #007700]([/COLOR][COLOR= #DD0000]watermerk.png[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$im[/COLOR] [COLOR= #007700]=[/COLOR] imagecreatefromjpeg[COLOR= #007700]([/COLOR][COLOR= #DD0000]http://url.nl/fotoserver/img/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]datum[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]img[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #FF8000]// Set the margins for the stamp and get the height/width of the stamp image[/COLOR]
[COLOR= #0000BB]$marge_right[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]568[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$marge_bottom[/COLOR] [COLOR= #007700]= -[/COLOR][COLOR= #0000BB]12[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$sx[/COLOR] [COLOR= #007700]=[/COLOR] imagesx[COLOR= #007700]([/COLOR][COLOR= #0000BB]$stamp[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$sy[/COLOR] [COLOR= #007700]=[/COLOR] imagesy[COLOR= #007700]([/COLOR][COLOR= #0000BB]$stamp[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #FF8000]// Copy the stamp image onto our photo using the margin offsets and the photo 
// width to calculate positioning of the stamp. [/COLOR]
imagecopy[COLOR= #007700]([/COLOR][COLOR= #0000BB]$im[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$stamp[/COLOR][COLOR= #007700],[/COLOR] imagesx[COLOR= #007700]([/COLOR][COLOR= #0000BB]$im[/COLOR][COLOR= #007700]) -[/COLOR] [COLOR= #0000BB]$sx[/COLOR] [COLOR= #007700]-[/COLOR] [COLOR= #0000BB]$marge_right[/COLOR][COLOR= #007700],[/COLOR] imagesy[COLOR= #007700]([/COLOR][COLOR= #0000BB]$im[/COLOR][COLOR= #007700]) -[/COLOR] [COLOR= #0000BB]$sy[/COLOR] [COLOR= #007700]-[/COLOR] [COLOR= #0000BB]$marge_bottom[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] imagesx[COLOR= #007700]([/COLOR][COLOR= #0000BB]$stamp[/COLOR][COLOR= #007700]),[/COLOR] imagesy[COLOR= #007700]([/COLOR][COLOR= #0000BB]$stamp[/COLOR][COLOR= #007700]));[/COLOR]

[COLOR= #FF8000]// Output and free memory[/COLOR]
[URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Content-type: image/png[/COLOR][COLOR= #007700]);[/COLOR]
imagepng[COLOR= #007700]([/COLOR][COLOR= #0000BB]$im[/COLOR][COLOR= #007700]);[/COLOR]
imagedestroy[COLOR= #007700]([/COLOR][COLOR= #0000BB]$im[/COLOR][COLOR= #007700]);[/COLOR]
?>


Ik hoop dat iemand me verder kan helpen omdat ik er zelf niet meer uitkom cry
Tnx!
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
header(Content-Disposition: attachment; filename=".$name.");

Onder de andere header zetten. $name uiteraard vervangen door jouw naam variabele
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rik schreef:
header(Content-Disposition: attachment; filename=".$name.");
Onder de andere header zetten. $name uiteraard vervangen door jouw naam variabele

Aha, thankss! Het werkt biggrin
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