-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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/
iEYEARECAAYFAk3KVdoACgkQqBnXnqWBgIsIGQCgjmrKIolRlfp3cvXG53kFDzYe
n+8AmwYrR7y7GPsvkK5MoiTpP3xTWJa+
=8FYf
-----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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en