Reputation: 6873
I would like to take a simple image file (500px width example) from a folder, in PHP and do exec('/usr/bin/convert -etc.') to the image and achieve this: http://imm.io/media/3O/3O7j.jpg . Basically, I want to draw 2 colored borders/rectangles around the image at that specific positions. Can anybody help compose such a command, or is it possible ?
Thank you.
Upvotes: 0
Views: 451
Reputation: 23216
This may be easier using the GD extension in PHP. Specifically, the imagesetstyle()
function to set line dashes, and imageline()
to draw the lines.
This example loads an image and draws a dashed line on it. You should be able to adapt it to your needs.
<?php
$im = imagecreatefromjpeg('/your/file.jpg');
$w = imagecolorallocate($im, 255, 255, 255);
$red = imagecolorallocate($im, 255, 0, 0);
/* Draw a dashed line, 5 red pixels, 5 white pixels */
$style = array($red, $red, $red, $red, $red, $w, $w, $w, $w, $w);
imagesetstyle($im, $style);
imageline($im, 0, 0, 100, 100, IMG_COLOR_STYLED);
imagejpeg($im, '/path/to/save.jpg');
imagedestroy($im);
?>
Upvotes: 1