tags:

views:

935

answers:

2

How can I get image data string from mysql db that has blob images? Thanks.

A: 

Assuming that you're using the default ORM (Propel) that comes with Symfony, $your_object->getImage()* should return whatever blob value you stored in the database.

You might already know this and it's not an option, but have you considered storing the images in a directory and using the database to store the path to the images ?

*Assuming 'image' is the field name in the database/schema.yml

sjobe
A: 

There is always flamewar about storing images in a database vs. filesystem.

Storing them in a database is more secure (if you need to secure access to them) but usually you need wrapper to read and display them in tag (if you do it).

There's a lot of pros and cons... Depends on your needs what is better.

and yes sjobe's $x->getImage() would be enough to get a blob content.

RomanT