how can i load a full image in variable
Posted: Fri Jun 18, 2004 2:57 am
i want to load a full imge in some sort of variable that i can pass to java applet..how can i do that
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
$data = file_get_contents('/path/to/the/file.jpg');
?>php manual, user comment wrote:Rather than using the temporary file, as described above, you can buffer the output stream. Someone else showed me this, and it seems to work very nicely.
Code: Select all
<?php //Start buffering the output stream ob_start(); // output the image as a file to the output stream Imagejpeg($im); //Read the output buffer $buffer = ob_get_contents(); //clear the buffer ob_end_clean(); //use $buffer as you wish... ?>