-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

bumping this up as i got no reply...
any input?

Am 11.05.2011 11:24, schrieb David Buchmann:
> hi,
> 
> i have binary content that i have to deliver to the client. what is the
> right way to do it? i found two solutions, but neither seems really good.
> 
> 
> 
> //in my controller, i get a binary stream (its stored in the database)
> 
> $picture = $this->method_that_returns_resource_stream();
> 
> // i can just use plain php and dump and die. not nice.
> header('Content-Type: image/jpeg');
> fpassthru($picture);
> die;
> 
> 
> /*
> or i can use a response, but then i have to read the stream into memory,
> which is unefficient.
> */
> 
> $response = new Response(stream_get_contents($picture));
> $response->headers->set('Content-Type', 'image/jpeg');
> return $response;
> 
> 
> cheers,
> david
> 

- -- 
Liip AG // Agile Web Development // T +41 26 422 25 11
CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3eSRoACgkQqBnXnqWBgIvXqwCeKUiyx3SWbDHTXGU2sonfpiCK
dnIAnjzV2wzXxrGtezoqlqhdc04Kip/E
=EnPc
-----END PGP SIGNATURE-----

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to