I have a PHP image object created using imagecreatetruecolor(). I'd like to send this via A开发者_如何学GoMFPHP to Flash. I understand the best format is using a ByteArray. How can I achieve this without writing the image to the disk?
Thanks, Josh
You cannot transfer the raw resource, but the usual course of action is to use an ob_start()
before the imagepng/imagejpeg/imagegif
functions, and get it in a variable with ob_get_clean()
. How it works with AMFPHP & ByteArrays is another matter, I have no experience with those.
<?php
$img = imagecreatetruecolor(30,40);
ob_start();
imagepng($img);
$bytes = ob_get_clean();
Do you mean something like this:
imagepng($resource);
This will send the image from the memory to the browser
精彩评论