View Full Version : Save to JPG
Paulskii
04-10-2008, 05:47 PM
I am able to print a movieclip, and also print it to a PDF therefore saving it to file...but I would like to be able to save to a JPG so that it can be sent through e-mail...I know that PDF can be sent, but its not as convenient as a JPG where anyone can save a JPG but you need the proper app to print to PDF...is it possible to save to JPG directly from flash? I have seen something about PHP...but that seemed to be fairly processor intensive? Am I wrong about that? Whats the best way, if any, to do this?
xxneon
04-10-2008, 06:05 PM
short of using a 3rd party projector .. but with an html embed swf the only way is to use a combination of BitmapData.getPixel() into an array and then sending that array to a php script to reconstruct the image..
here is a thread with some examples using Flash/PHP
http://www.actionscript.org/forums/showthread.php3?p=722147
awesome thread :cool:
*bookmarked*
Paulskii
04-11-2008, 02:36 PM
I tried to follow the Flash-db tutorial...but it applies filters and I cannot seem to simplify the code to just take a damn snapshot...I also looked at the sephiroth one, but that I could just not understand at all...how can I simplify the flash-db code to work for me....xxneon-would It be similar to my print function as far as the capturing what is visible in the viewing window?
I tried to follow the Flash-db tutorial...but it applies filters and I cannot seem to simplify the code to just take a damn snapshot...I also looked at the sephiroth one, but that I could just not understand at all...how can I simplify the flash-db code to work for me....
In that thread I posted there is a link for this thread regarding the Flash-db tutorial which does not appear to have any filters applied for creating a snap shot..
http://www.actionscripts.org/forums/showthread.php3?p=420106
I think AS3 also has some built-in features for this (another reason to port your project to AS3 and take advantage of its features and speed, of course I dont know AS3 myself so its poor advice with no solid backing other than people say its great ;-) (ha, ha)
Hopefully xxneaon can hep you out ;)
Paulskii
04-11-2008, 02:55 PM
Ok...im trying to test this, but it doesnt work...it opens a new tab in FF for me...and the url is the show.php file...which ends HTTP 405 error...page cannot be displayed
check it out...
www.expocadvr.com/new/index.html
btw...this is the latest feb 07 version...(the previous versions did the same thing though)
xxneon
04-11-2008, 03:16 PM
405 errors are result of the php script not executing correctly i think.. its accually a general error .. but you can search to see how to get your browser to show you a more detailed error i think..
Paulskii
04-11-2008, 08:04 PM
well this is the PHP Code used....any ideas whats wrong with it?
<?php
$data = explode(",", $_POST['img']);
$width = $_POST['width'];
$height = $_POST['height'];
$image=imagecreatetruecolor( $width ,$height );
$background = imagecolorallocate( $image ,0 , 0 , 0 );
//Copy pixels
$i = 0;
for($x=0; $x<=$width; $x++){
for($y=0; $y<=$height; $y++){
$int = hexdec($data[$i++]);
$color = ImageColorAllocate ($image, 0xFF & ($int >> 0x10), 0xFF & ($int >> 0x8), 0xFF & $int);
imagesetpixel ( $image , $x , $y , $color );
}
}
//Output image and clean
header( "Content-type: image/jpeg" );
ImageJPEG( $image );
imagedestroy( $image );
?>
xxneon
04-11-2008, 08:26 PM
what if you just do this as a simple call back to see if the php is getting the info correctly..
<?php echo $_POST["img"] ?>
that should atleast show you the string of pixel values in the browser window.. see if something that simple causes the error..
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.