Storing an image in a database/table field |
[eluser]SpooF[/eluser]
It really can't be done using what you learned in the second video tutorial. There are a few ways you can go about doing this, one is to simple store a URL to an image file that is hosted remotely. The second way is to upload the image file to the server and store the path to the image file. The third way is to upload the file and store the binary data into the mysql database. Each of these options is a a little more complex than the one before it. The first one is pretty simple, all your going to do is create a varchar or text field in the database and store the URL to the image. Then you can simple just take the stored value in the database and put it in your image tag. The second one is basically the same as the first but your going to need to read up on the File Uploading Class. Once you upload the file you would just store the path to the file in the database. The first option, which I would not really recommend doing, is to upload the file and read the binary data. Then store the file in a blob field in your database. To get access to the file you would then need to create a function that would read the binary data out of the database and recreate the image using headers. I would suggest doing the first options for now. |
Messages In This Thread |
Storing an image in a database/table field - by El Forum - 05-28-2009, 06:22 PM
Storing an image in a database/table field - by El Forum - 05-28-2009, 07:11 PM
Storing an image in a database/table field - by El Forum - 05-28-2009, 08:39 PM
Storing an image in a database/table field - by El Forum - 05-29-2009, 02:55 AM
Storing an image in a database/table field - by El Forum - 05-29-2009, 04:56 AM
Storing an image in a database/table field - by El Forum - 05-30-2009, 04:35 AM
|