Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4274194
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:48:52+00:00 2026-05-21T07:48:52+00:00

I’m trying to display an image exported from a flash BitmapData in a basic

  • 0

I’m trying to display an image exported from a flash BitmapData in a basic webpage.

The export from flash works perfectly :

import flash.display.BitmapData;
var vBitmap = new BitmapData(300, 400, true, 0x000000);
vBitmap.draw(themovieclip_mc);
btn1.onRelease = function() {
    var vLV = new LoadVars();
    vLV.tableData = new Array();
    for (i=0; i<300; i++) {
        for (j=0; j<400; j++) {
            vLV.tableData.push(vBitmap.getPixel(j, i));
        }
    }
    vLV.send("webpage.php", "_self", "POST");
};

Then I get the image in the webpage.php file

    <?php
    $lv = $_POST['tableData'];
    $temp = explode(",",$lv);
    settype($temp[1],'integer');
    $img = imagecreatetruecolor(300,400);
    $k = 0;
    for($i=0; $i<300; $i++){
        for($j=0; $j<400; $j++){
            imagesetpixel($img,$j,$i,$temp[$k]);
            $k++;
        }
    }

$temporary_file_name = tempnam("/tmp");
imagejpeg($img,"$temporary_file_name",100);

?>

<html>
<img src="/tmp/<?php echo $temporary_file_name; ?>" />
<h1>Lorem ipsum</h1>
<p>lorem ipsum dolor sit amet</p>
</html>

the above code does NOT work, I can’t find a way to display the image embedded in the webpage. Any help woud be really appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:48:52+00:00Added an answer on May 21, 2026 at 7:48 am

    So, I finally found my way through this.
    That might not be the best way to do it, but at least it works.

    //AS3
    
    import com.adobe.images.JPGEncoder;
    
    function createJpg(aMovieClip, aQuality){
        var vSource = new BitmapData(200, 304, true, 0 );
        vSource.draw(aMovieClip, new Matrix(1,0,0,1,100,152)); // decale de width/2 et height/2
        var vEncoder = new JPGEncoder(aQuality);
        var vByteArray = vEncoder.encode(vSource);
    
        return vByteArray;
    };
    
    // export image to server
    function exportJpg(aMovieClip){
        var vByteArray = createJpg(aMovieClip, 80);
        var vRequest:URLRequest = new URLRequest('URL_TO_THE_PHP_FILE');
        var vLoader: URLLoader = new URLLoader();
        vRequest.contentType = 'application/octet-stream';
        vRequest.method = URLRequestMethod.POST;
        vRequest.data = vByteArray;
        navigateToURL(vRequest, "_self");
    };
    
    // save image on users computer
    function saveJpg(aMovieClip, aString){
        var vByteArray = createJpg(aMovieClip, 80);
        var vFR = new FileReference();
        vFR.save(vByteArray, aString);
    };
    

    Then the PHP/HTML file

    <?php
    
    if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) {
    
        $img =  $GLOBALS["HTTP_RAW_POST_DATA"];
        $prefix = "foo";
        $path = "/full/server/path/to/directory/with/777/permissions";
    
        // give a unique name to the file
        $name = $prefix.md5(time().rand());
    
        $temporary_file_name = $path.'/'.$name.'.jpg';
    
        $fp = fopen($temporary_file_name, 'wb');    
        fwrite($fp, $img);
        fclose($fp);
    
        // find the name of the image without the full server path
        $array = explode("/", $temporary_file_name);
        $length = count($array);
        $filename = $array[$length - 1];
    
        //give a path to the image file
        $imagepath = "http://www.domain.com/directory/".$filename;
    
    
    }else{
        // error : the POST data was not found
    }
    
    ?>
    
    <html>
    <head>
    </head>
    <body>
        <h1>Lorem ipsum</h1>
        <p><img src="<?php echo $imagepath; ?>"</p>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
i want to parse a xhtml file and display in UITableView. what is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.