How to insert an image in Mysql?

Asked

Viewed 6,326 times

1

I’d like to add images to the table, nothing too complex.

  • I would like to add the directory if possible
  • This bank will not have an interface
  • I’d like to see the image by select, but I don’t think that’s possible.

What do you think?

  • 2

    Hi, welcome to [en.so]. Please give more details about your problem. Check out the guide [Ask] and [Edit]and the question to improve it.

  • Does this help you or answer the question? http://answall.com/questions/9540/upload-de-imagens-com-php-mysql/9579#9579 or this http://answall.com/questions/14240/upr-campo-longblob-e-possible.

1 answer

1


There are two common approaches to inserting an image into the database:

  1. Save the image in a directory (eg.: C:\imagens) and in the bank the name of the image file, to retrieve it later.

  2. Save the image itself on the seat using a column of the type blob (binary).

In both cases nay it is possible to view the image directly (through a select).

In the second case it is necessary to use a function/method that "converts" the binary image to file again, which makes everything more difficult to implement.


Check out this question here: It is wrong to write byte of images in the database?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.