Copy link to clipboard
Copied
Hi All,
I am integrating Mario Klingemann's BitmapExporter into a small project and i have it so that the user can press a button and generate the png. Based on his comments in the code, I think that there may be a download dialog box/option that is supposed to pop up, but cant be sure about this. My problem is that i need some way for the user to get the file back after they generate it to the directory on my server. so far the code generates a uniqueID for each png. I was thinking that If i knew the specific file name that the user generates, then i would have more luck being able to somehow allow them to retrieve the file... Can anyone give me any insight as to what my best options might be?
The catch is that Mario's code also relies on PHP to generate the PNG, so my head is spinning a bit.
//some of the AS code:
private function onSaved( serviceUrl:String, fileName:String ):Void
{
BitmapExporter.dispatchEvent({
type: "saved",
target: BitmapExporter,
url: serviceUrl,
fileName: fileName,
uniqueID: uniqueID,
sentBytes: sentBytes,
time: totaltimer,
compressionRatio: sentBytes / (bitmapWidth * bitmapHeight * 4)
});
reset( true );
}
//some of the PHP code which i believe helps generate the random number/unique ID:
case "getImageHandle":
$uniqueID = md5( microtime() . rand() );
sendResult( "success=1&uniqueID=$uniqueID" );
break;
Maybe i should be looking more in a PHP Forum, but I have always gotten my questions answered here, so wanted to try here first. Thank you in advance!
- Pat
Copy link to clipboard
Copied
fileName looks like the string you need to track down.
Copy link to clipboard
Copied
Thanks KGLAD. I steered away from this variable because of the comment from the creator:
// filename: The suffix of the filename automatically decides which output format you get, possible values are: | |
// "yourfilename.jpg" or "yourfilename.jpeg" for JPEG format | |
// "yourfilename.png" for PNG format | |
// "yourfilename.bmp" for BMP format |
He makes it sound like this is the file type doesnt he?
Copy link to clipboard
Copied
yes, but you don't need (or want) to change the suffix.
Copy link to clipboard
Copied
Thanks KGLAD. It was actually the PHP side that i was able to change:
$uniqueID = md5( microtime() . rand() );
I changed it to:
$uniqueID = ( "anyname" );
Problem is now that it only allows one file called "anyname.png" to exist in that directory.
Now i think i need to figure out through PHP how to add a number or something to each subsequently generated bitmap called "anyname.png" so that the user(s) do not overwrite the files. hmmmmmm
Copy link to clipboard
Copied
you can use loadvars to send a variable (like the file name) from flash to your php file.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now