|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-06-27 05:02 UTC] letmegetone at hotmail dot com
Description:
------------
I want to put some worked codes into a function, in order to make my main script shorter.
All other MING classes work well,such as SWFSprite,SWFShape, except SWFBitmap.
I can get the error message from apache2:
PHP Fatal error: output() [<a href='function.output'>function.output</a>]: Initial Jpeg marker not found!
It seems that the SWFBitmap object can not be returned in a function.
I tried test like this:
CODE I + CODE III :FAILED
CODE II + CODE IV :WORKS
CODE I + CODE II + CODE III : WORKS
Reproduce code:
---------------
function get_b()//CODE I
{
$mfile="xx.jpg"; $fp=fopen($mfile,"r");
$string=fread($fp,filesize($mfile));
$b = new SWFBitmap($string);
fclose($fp);
return $b;
}
$mfile="xx.jpg"; $fp=fopen($mfile,"r");//CODE II
$string=fread($fp,filesize($mfile));
$b = new SWFBitmap($string);
fclose($fp);
$s = new SWFShape();
$scale= $s->addFill(get_b()); //CODE III
$scale= $s->addFill($b); //CODE IV
Expected result:
----------------
Can I put the code with the SWFBitmap object into a function?
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 21:00:01 2025 UTC |
I tested it,and found: $img=file_get_contents("1.jpg"); $s = new SWFShape(); $imgf = $s->addFill($img, SWFFILL_TILED_BITMAP); $s->setRightFill($imgf); $m->add($s); $m->output(); it works. But if I try to remove the data of string $img before ouput() called $img=""; $m->output(); it failed. Is that means that all data resources the SWFMovie used should be keept untill output() is done?