0

Adding copyright url in image

I am trying to find a way to insert my website URL in the copyright headers of a png or a jpg image when a user uploads the image to my site. I am using PHP on the server.

Is this possible to do?

If so, please point me in the right direction.

I do not need a watermark. Just a text URL in the headers somewhere, which I can later read if same image is reuploaded to my site.

It does not has to be in the headers specifically, anywhere else in the image data will also do.

I am sorry that I do not have any code to show for this. I don't even know where to start looking to begin coding for this...

Thanks

1 Answers1

1

Adding metadata to PNG: Install imagemagick for PHP

https://www.geeksforgeeks.org/how-to-install-imagemagick-and-imagick-php-extension-in-ubuntu/

<?php
$image = new Imagick();
$image->newImage(300, 200, "black"); // or load your PNG into Imagick

$image->setImageProperty('keywords', 'Imagick');
echo $image->getImageProperty('keywords');
?>

From Add metadata to PNG image using PHP


Adding metadata to JPG https://packagist.org/packages/alexzv/iptc-jpeg

composer require alexzv/iptc-jpeg
Kinglish
  • 23,358
  • 3
  • 22
  • 43
  • Thanks for the answer. But am not on a dedicated server to install packages of my own. Is there no way of doing it with core PHP functions itself? Can't I leave a commented line in the image file somewhere at top or bottom? Like in PHP we use a "//" to leave a commented line. In htaccess we use a "#" sign etc. Something like that, ignored by other image processsors, but readable by me... Thanks – John Smith May 08 '21 at 23:42
  • Does your php installation have any image processing packages? GD, ImageMagik, Gmagik? – Kinglish May 08 '21 at 23:46
  • Yes, GD is there. I am using it to resize uploaded images. – John Smith May 09 '21 at 10:07