Home > Archive > PHP DB > March 2004 > Re: [PHP-DB] Insert an image in a Mysql table
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: [PHP-DB] Insert an image in a Mysql table
|
|
| Filip De Waard 2004-03-26, 11:12 pm |
| On Mar 20, 2004, at 3:11 PM, charalambos nicolaou wrote:
> Hi,
>
> I have created a MySQL table with a blob field and I don=92t =
know how=20
> to insert an image to it. Help me please because I am going crazy.
Use your filesystem instead, databases might be capable of storing=20
binary data but they are not perfect. Use your filesystem and store the=20=
filename in your database.
If you would've used google, you would've found this:=20
http://www.phpbuilder.com/columns/florian19991014.php3
Regards,
Filip de Waard
| |
|
|
>
I store in the blob not an image but the string:
img[]=path/file.jpg&description=&var[]= etc and so on for any number of
images and corresponding details. Then retrive the string as $images with
a
query as usual and use:
parse_str($images[0]); /* GIVES ARRAY $img AND $description etc */
Regards,
John
| |
| Filip De Waard 2004-03-26, 11:12 pm |
| On Mar 21, 2004, at 8:44 AM, Stuart Gilbert wrote:
> Filip de Waard wrote:
know=20[color=darkred]
[color=darkred]
[color=darkred]
>
> And what if he has a perfectly good reason to store the data in the =
db?
> No offense but you didn't really help him with his query at all.
I can't think of a scenario where storing binary data in a database is=20=
the best solution, but I'm sure there are situations where this is an=20
interesting option (since there has to be a reason databases include=20
this option). I haven't found one yet and I'm pretty sure that=20
Charalambos should use the filesystem instead, since that is the=20
correct answer for 99.999% of all cases.
> And yeah, search google!
Using Google I found the link that solved his problem in 2 seconds. I=20
told him to use Google next time and gave him the link to his answer.=20
He thanked me for it, for godsake!
I don't have a clue about what reason you have to kick somebody in the=20=
groan who is just helping, while you didn't help Charalambos a bit.
Regards,
Filip de Waard
| |
| Filip De Waard 2004-03-26, 11:12 pm |
| On Mar 21, 2004, at 9:19 PM, Stuart Gilbert wrote:
> Filip de Waard wrote:
>
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
[color=darkred]
>
> I was telling him, and people in general, to search Google, not you =20=
> :) I'm sure you know what to do very well.
Thank you :-)
> Sorry if it felt like a personal attack of some sort, I was just=20
> saying that if he asks how to do something like storing an imagine a=20=
> db then the chances are that he wants to do that, and not something=20
> else. Shouldn't matter if it's not the ebst way to do something.
IMHO it's always the best thing to give somebody what he's asking for,=20=
even if it's not the best way to do something. However, nobody will=20
learn anything when you just tell them how they can solve their problem=20=
the wrong way, even when they ask for it.
> Anyway, sorry.
No problem. I misinterpreted what you were saying as a flame against me.
Cheers,
Filip de Waard
|
|
|
|
|