how can i load a full image in variable
Moderator: General Moderators
-
bugthefixer
- Forum Contributor
- Posts: 118
- Joined: Mon Mar 22, 2004 2:35 am
how can i load a full image in variable
i want to load a full imge in some sort of variable that i can pass to java applet..how can i do that
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
if the file already exists:
as for using dynamic images created by php..
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... ?>