1

any way to take an screenshot of particular part of HTML. like canvas in html5 my HTML part is store in database like I am making a Page creating header footer main content . and storing header HTML ,footer HTML , and main part HTML in database .

Is any particular way to create screen shot of particular Page HTML . And screen shot will be any kind of image so i can attach image in email .

I have gone through below question

Using HTML5/Canvas/JavaScript to take screenshots

<script type = "text/javascript" >
var text = 'mycanvas';
var x = 0;
var y = 0;
var h = 5; //height
var a = 5; //angle
var n = 150; //no of lines
if (n % 2 == 0)`enter code here` {
    n = n + 1
}
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");

ctx.moveTo(x, h);

for (; n > 0; n--) {
    if (n % 2 == 0) {
        y = y + h;
    }else {
        y = 0;
    }
</script>

My server side programming is php and database mysql

Community
  • 1
  • 1
  • So you want to know how to upload the canvas image to a PHP script? – hakre May 10 '12 at 08:52
  • Please add your solution as an answer below and accept it so that your question is marked as answered. Thank you for your support. – hakre Jun 01 '12 at 15:04

1 Answers1

1

I think you want something like ImageMagick. A php interface to crete/write information to images or create them.

http://www.imagemagick.org/script/index.php

http://www.imagemagick.org/script/api.php#php

Example code:

<?php
 $magick_wand=NewMagickWand();
 MagickReadImage($magick_wand,'rose.jpg');
 $drawing_wand=NewDrawingWand();
 DrawSetFont($drawing_wand,"/usr/share/fonts/bitstream-vera/Vera.ttf");
 DrawSetFontSize($drawing_wand,20);
 DrawSetGravity($drawing_wand,MW_CenterGravity);
 $pixel_wand=NewPixelWand();
 PixelSetColor($pixel_wand,"white");
 DrawSetFillColor($drawing_wand,$pixel_wand);
 if (MagickAnnotateImage($magick_wand,$drawing_wand,0,0,0,"Rose") != 0)
{
 MagickEchoImageBlob( $magick_wand );
}
 else
{
  echo MagickGetExceptionString($magick_wand);
}
?>
Scriptor
  • 1,125
  • 1
  • 6
  • 13