douwei1174 2013-08-07 15:51
浏览 34
已采纳

在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

  • 写回答

1条回答 默认 最新

  • dtvjl64442 2013-08-07 16:13
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题