I have uploaded and stored multiple images at a time in a MySQL database using jQuery and PHP. This time I am storing image name in database and uploads file in a folder at server.
Now, I want to retrieve image name from database and preview this image and also want to provide actions of delete and add images.
Can anyone help me out on this issue?
Here is my steps:
Create a php file
Connect to mysql database
Select the table where the images was saved.
Loop the query.
Add delete query.
Hope this helps.
Related
I am trying to make a form in php that uploads an image from mobile. The name of the image is stored in mysql database for retrieval. The code is working fine. I wanted to know if I can store the location of the image that is stored in the phone. I want to store the location in mysql database table column.
I'm quite new to PHP and MYSQL.
I need to add an image to an existing record.
So I have a list of records and when I click the link directing to this page.
In this form I would like to ad an image.
Thanks in advance
I would highly discourge you from saving files in a database like that.
Here are the steps that I have used before:
I would create a folder on the server for each user.
Save the filename and extension in a table.
Save the file to the server folder.
If I wanted to grab a file I would go to the right directory and file name.
Examples:
Profile Picture = {userFiles/userID/filename}
Contract for Billy = {userFiles/{Billy'sID}/{filename}
I am new to ci. I have seen the documentation for file uploader and
implemented the sample page. But I want to upload the image and store it into MySQL database.
Can anyone provide solution for it with example?
Upload the image to a folder called uploads and then store the path to the image in your DB
I am looking for a very basic image uploader script. Just one that uploads the image to a folder and stores the filename in a mysql database.
Is there any small easy to intergrate scripts anyone know of?
Thank you for the help
This tutorial does what you want http://php.about.com/od/phpwithmysql/ss/Upload_file_sql.htm in addition stores some extra metadata in the same table (employee details) along with the filename (photo)
Images can be saved as blob types in a database
You have to create a form with a browse button (google it)
You have to create your table with the a field of type blob
That's it.
i just wanna ask on how to make a simple gallery for my website wherein the images used to display are from database and will automatically display on the gallery? so that when i have to update the images i won't enormously create thumbnails..??
I would recommend against keeping the image data in a database, it's almost always a bad idea.
I would recommend storing metadata about the images in the database and then including a pointer to the file (the image's path on the local filesystem). If you need to make thumbnails create them as the images are added, store them on the filesystem too and store the path to them in the table too.
Another approach is to have the filename of the image and thumbnail as a function of the image ID. E.g. store it on the server at /some/directory/images/123.jpg and /some/directory/images/123_thumbnail.jpg where 123 is the id of the image.
use mysql BLOB storage - Example: http://www.anyexample.com/programming/php/php_mysql_example__image_gallery_%28blob_storage%29.xml
You can create the thumbnails and update the database when the images are uploaded to a directory within your http path. A simple php routine can extract the picture names from the db and include them in your gallery.