flex+php online photo One [51 space]

Source: Internet
Author: User
Tags php online


Yesterday with Flex+php did an online photo of the small dongdong, you can achieve the real time members avatar real-time online photo update.
First of all, the principle of speaking:
1, will camera content display in the video, this does not understand the reference ActionScript manual, Inside has the detailed explanation as well as the code,
2, define the BitmapData object,
M_picturebitmapdata = new BitmapData (default_camera_width,default_camera_height);
The contents of the video are then written into the BitmapData object, M_picturebitmapdata.draw (Video,new Matrix ());
3, from left to right, from top to bottom, a pixel of a pixel to read the RGB value of BitmapData, all the RGB value with "," separate, write into a string,
for (var i:int = 0; i < default_camera_width; i++)
{
for (var j:int = 0; J < Default_camera_height; J + +)
{
if (M_picturedata.length > 0)
{
M_picturedata + = "," + M_picturebitmapdata.getpixel (i,j). toString ();
}
Else
{
M_picturedata = M_picturebitmapdata.getpixel (i,j). toString ();
}
}
}
Service.getoperation ("Createjpeg"). Send (Pic_width,pic_height,m_picturedata)//Save with amfphp
4, in the service side of those RGB values extracted, a pixel of a pixel point of painting:
$img =imagecreatetruecolor ($width, $height);
$m _temppics=explode (', ', $bitmap _data);
for ($i = 0; $i < $width; $i + +)
{
for ($j = 0; $j < $height; $j + +)
{
$pic _argb = (int) $m _temppics[$i * $height + $j];
Imagesetpixel ($img, $i, $j, $pic _argb);
}
}
Imagejpeg ($img, ". /.. /image/header/0.jpg ");
Imagedestroy ($IMG);
return true;
5, the detailed source code in the attachment, the front is just some important hints. Well, to understand amfphp, and flex.
What's not clear,
Let's look at the test.html file.
if (Hasproductinstall &&!hasrequestedversion) {
Mmdoctitle is the stored document.title value used by the installation process to close the windows that started the Pro Cess
This is necessary in order to close browser windows that are still utilizing the "the" Allation has completed
Do not MODIFY the following FOUR LINES
Location visited after installation are complete if installation is required
var Mmplayertype = (Isie = = True)? "ActiveX": "PlugIn";
var mmredirecturl = window.location;
Document.title = Document.title.slice (0) + "-Flash Player Installation";
var mmdoctitle = Document.title;
Ac_fl_runcontent (
"src", "Playerproductinstall",
"Flashvars", "mmredirecturl=" +mmredirecturl+ ' &mmplayertype= ' +mmplayertype+ ' &mmdoctitle= ' +MMdoctitle+ ' ",
"width", "100%",
"Height", "100%",
"Align", "Middle",
"id", "Hphoto",
"Quality", "High",
"bgcolor", "#869ca7",
"Name", "Hphoto",
"allowScriptAccess", "Samedomain",
"Type", "Application/x-shockwave-flash",
"Pluginspage", "Http://www.adobe.com/go/getflashplayer"
);
else if (hasrequestedversion) {
If we ' ve detected an acceptable version
Embed the Flash Content SWF when all tests are passed
Ac_fl_runcontent (
"src", "Hphoto",
"width", "100%",
"Height", "100%",
"Align", "Middle",
"id", "Hphoto",
"Quality", "High",
"bgcolor", "#869ca7",
"Name", "Hphoto",
"Flashvars", ' historyurl=history.htm%3f&lconid= ' + lc_id + ',
"allowScriptAccess", "Samedomain",
"Type", "Application/x-shockwave-flash",
"Pluginspage", "Http://www.adobe.com/go/getflashplayer"
);
else {//Flash is too old or we can ' t detect the Plugin
var alternatecontent = ' Alternate HTML content should is placed here. '
+ ' This content requires the Adobe Flash Player. '
+ ' <a href=http://www.adobe.com/go/getflash/>get flash</a> ';
document.write (AlternateContent); Insert Non-flash Content
}
-->
</script>
<noscript>
<object classid= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
Id= "Hphoto" width= "100%" height= "100%"
codebase= "Http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" >
<param name= "movie" value= "hphoto.swf"/>
<param name= "Quality" value= "High"/>
<param name= "bgcolor" value= "#869ca7"/>
<param name= "allowscriptaccess" value= "Samedomain"/>
<embed src= "hphoto.swf" quality= "High" bgcolor= "#869ca7"
Width= "100%" height= "100%" name= "Hphoto" align= "Middle"
Play= "true"
Loop= "false"
Quality= "High"
Allowscriptaccess= "Samedomain"
Type= "Application/x-shockwave-flash"
Pluginspage= "Http://www.adobe.com/go/getflashplayer" >
</embed>
</object>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.