在PHP中使用表格缩略图并将其发送到AS3

I'm making image gallery using AS3. I read given directory with PHP, returning paths to images in it as array. I would like also to form thumbnails, serialize them, send to as3 as array, and create bitmaps with this data.

Please help me through these steps:

-Resizing image in PHP and serializing it

-Forming bitmap in AS3 with serialized data

As for the first requirement, I would thumbnail the image with code something like 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 the binary encoding you can use the base64 encode function in php (http://php.net/manual/en/function.base64-encode.php) If you want to send this Action Script, read up on the process at this S/O question: Send a array from PHP to AS3? - it appears that you can simply print/echo the information as an AS3 variable.

This S/O question may help you make images from base64: Create image from data-in-uri (base64-encoded PNG) in ActionScript