This question already has an answer here:
i am making an antibot that displays different pictures, and asks the user to click on a specific picture. However, i would like some small random change to be made to the picture each time, so that software could not analyze and determine which picture is beeing displayed...
I would like one horizontal and one vertical line to be added at random coordinates with random color to the picture each time, then display the picture using get_file_contents and header.
Hope this makes sense... I would not want the changes to be saved to the picture, but only displayed to the user... I am using file_get_contents and header to display the picture, like this:
$id = $_GET['id'];
$image = "images/".$id . ".jpg";
$content = file_get_contents($image);
header('Content-Type: image/jpeg');
echo $content;
exit()
Thanks...
</div>
Using GD within PHP would allow you to do this
http://php.net/manual/en/book.image.php
create a file called image.php
From the php manual:
<?php
header("Content-type: image/png");
$string = $_GET['text'];
$im = imagecreatefrompng("images/button1.png");
$orange = imagecolorallocate($im, 220, 210, 60);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
imagepng($im);
imagedestroy($im);
?>
You could add a line by using the imageline function
<?php
header("Content-type: image/png");
$string = $_GET['text'];
$im = imagecreatefrompng("images/button1.png");
$orange = imagecolorallocate($im, 220, 210, 60);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
imageline($im, $x1, $y1, $x2, $y2, $orange);
imagepng($im);
imagedestroy($im);
?>
There are so many PHP GD functions available to achive this I think below code snippet may help you
<?php
$im = imagecreatefrompng("images/yourImage.png");
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
// Draw a vertical dashed line
imagedashedline($im, 50, 25, 50, 75, $white);
// Save the image
imagepng($im, './imagewithdashedline.png');
imagedestroy($im);
?>
reference PHP GD imagedashedline function