actionscript 3 - Form thumbnail in PHP and send it to AS3 -
i'm making image gallery using as3. read given directory php, returning paths images in array. form thumbnails, serialize them, send as3 array, , create bitmaps data.
please me through these steps:
-resizing image in php , serializing it
-forming bitmap in as3 serialized data
as first requirement, thumbnail image code this:
$source_image = imagecreatefrompng( www_root . 'img/' . $yourpath . '.png'); $source_imagex = imagesx($source_image); $source_imagey = imagesy($source_image); $dest_imagex = 200; $dest_imagey = 200; $dest_image = imagecreate($dest_imagex, $dest_imagey); imagecopyresampled($dest_image, $source_image, 0, 0, 0, 0, $dest_imagex, $dest_imagey, $source_imagex, $source_imagey); header("content-type: image/png"); imagepng($dest_image, www_root . 'img/' . "small" . $yourpath . '.png' ,9);
for binary encoding can use base64 encode function in php (http://php.net/manual/en/function.base64-encode.php) if want send action script, read on process @ s/o question: send array php as3? - appears can print/echo information as3 variable.
this s/o question may make images base64: create image data-in-uri (base64-encoded png) in actionscript
Comments
Post a Comment