Dynamically Save Canvas Coordinates (Drawing) to PNG or JPEG using PHP
I know a Canvas drawing can be saved as a PNG image using a modern browser such at Firefox 5 开发者_StackOverflow中文版I need to do the same by converting the X and Y coordinates into a PNG file using PHP how would I go about that?
Thanks in Advance!
Did you mean creating images with php? link
You Can Start By:
http://ir.php.net/manual/en/function.imagecreatefrompng.php
If you want to flip your image then: posted by xafford
<?php
define ( 'IMAGE_FLIP_HORIZONTAL', 1 );
define ( 'IMAGE_FLIP_VERTICAL', 2 );
define ( 'IMAGE_FLIP_BOTH', 3 );
function ImageFlip ( $imgsrc, $mode )
{
$width = imagesx ( $imgsrc );
$height = imagesy ( $imgsrc );
$src_x = 0;
$src_y = 0;
$src_width = $width;
$src_height = $height;
switch ( (int) $mode )
{
case IMAGE_FLIP_HORIZONTAL:
$src_y = $height;
$src_height = -$height;
break;
case IMAGE_FLIP_VERTICAL:
$src_x = $width;
$src_width = -$width;
break;
case IMAGE_FLIP_BOTH:
$src_x = $width;
$src_y = $height;
$src_width = -$width;
$src_height = -$height;
break;
default:
return $imgsrc;
}
$imgdest = imagecreatetruecolor ( $width, $height );
if ( imagecopyresampled ( $imgdest, $imgsrc, 0, 0, $src_x, $src_y, $width, $height, $src_width, $src_height ) )
{
return $imgdest;
}
return $imgsrc;
}
?>
These having more function. http://php.net/manual/en/function.imagecopymerge.php
http://php.net/manual/en/function.imagecopy.php . here nineslice
will be correct for you i think.
精彩评论