Register now or log in to join your professional community.
If your question is how to draw a canvas (canvas is a rectangular area on a page)and an image over it in Php then here is a simple example to draw a black rectangular canvas and a pink rectangle over that canvas:
<?php
// Create a200 x200 canvas image
$canvas = imagecreatetruecolor(250,200);
// Allocate color for rectangle
$pink = imagecolorallocate($canvas,255,105,180);
// Draw rectangle with its color
imagerectangle($canvas,50,50,200,150, $pink);
// Output and free from memory
header('Content-Type: image/jpeg');
imagejpeg($canvas);
imagedestroy($canvas);
?>
Cheers!
Please check this tutorial :
http://www.html5canvastutorials.com/tutorials/html5-canvas-shape-fill/
Well there are lots of ways to create Canvases in PHP. There is ImageManipulation Library ann Canvas Class I used once. I do not know what you need actually and why you asked this question so I take it as general knowledge discussion.
Once you have the class you can call it this way to use an Image Canvas:
require_once "canvas.php"; // Canvas Class Path
$img = new canvas("image/test.jpg"); // Image to be manipulate
$img->resize("1024", "768") // Resizing Image if needed
->filter("grayscale") // FIltering to Grey Scall, web optimized
->text("JayZee", array( // Text you want to put on Canvas, text properties
"color" => "#fff",
"background_color" => "#000",
"size" =>10,
"x" => "right",
"y" => "bottom"))
->save("temp/new_image.png"); // Saving image to new format, PNG
So thats how you do it. And there are many other features in PHP Canvas . I hope thats clear how to use Image Canvas using PHP Canvas.