Skip to main content
Participant
March 7, 2013
質問

BitmapExporter - generate PNG with specific filename

  • March 7, 2013
  • 返信数 1.
  • 728 ビュー

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

このトピックへの返信は締め切られました。

返信数 1

kglad
Community Expert
Community Expert
March 7, 2013

fileName looks like the string you need to track down.

anglim_wp作成者
Participant
March 7, 2013

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?

kglad
Community Expert
Community Expert
March 7, 2013

yes, but you don't need (or want) to change the suffix.