Go to Options/Miscellaneous and enable file uploads. Then hit the Upload tab, setup your upload directory and start uploading images. The relevant HTML to display your images will be presented to you upon completion of a successful upload.
Wonderful! I thought the file upload was for others to upload files. It isn’t quite clear on the admin panel.
Can you upload more than one at a time?
Just gave this a try and what it does is upload files to a folder in the wordpress folder. I can do that easily with ftp. By the gross. I want to add images to the database itself and then call them out from within a post.
The WordPress Codex does it beautifully. Is it available in WordPress?
Yes, you can do this, but you can’t add images to a MySQL database. All you have to do is upload the files via the Upload menu (as you have discovered). After a successful upload, you will be presented with the HTML code for the image. Just enter that into your post.
For example, I put the image in the following post by uploading it via the upload tab and entering in the resulting HTML code.
I understand that the upload puts the file on the website as a FILE and then you link to it. Got that.
So you are saying I can’t add the images to a MySQL database, even though I read about it in the PHP how to manuals and articles.
I think you mean that they can’t be added to the database through WP. I thought there might be a plugin or something that would use images already in a database.
You cannot put images in a database. You can put information about images in a database.
Can you give us a link to what you have read, so that we can get an idea of what exactly you are trying to achieve?
“You cannot put images in a database.”
You guys are smoking something, and I want some.
I don’t know of a script/plugin/gallery for storing images in your database, and I’m not sure I’d recommend one if I did. There’s too many good reasons not to use the db to store binary files. One is resource overhead. Another is, you’d be unable (well, find it difficult) to output HTML content after sending the content header and image data. Unless you have a very specific reason for doing it, it’s not worth the hassles.
By the way, Codex is not storing images in its database, though it does hold some “wiki relationship” info on each.
One quick question for Lorelle. If you could store images in your database (which you can’t) and if you could call those for later use (which you can’t, because you can’t store images in a database), how is that different from storing the image on your server (yes, as a file) and calling it for later use (via a very simple and short HTML tag)?
Okay, then, like the Codex, information is stored about the images in the database…and that hosts the link to the image on the site. I’ve now just gotten off the plane and will be away from all my books and stuff for a month so I can’t give you a specific on what I found.
The reason this appealed to me is that the Codex method is very simplistic for the link, fewer keystrokes, and the information about the image could be stored, like who took the picture, the short alt tag and the long description, and possibly alternative descriptions depending upon the use of the image.
Here is a specific. As professional nature photographers, we have tons of photographs on our site. Most are used as educational material to accompany our articles, and many of the identical photos are used as gallery images. Just pretty pictures. We use a lot of redundant info on the pictures and sometimes need the same picture as a thumbnail and as a large image, and it basically looks like this:
<img src="/blah/blah/blah/leafpic.jpg" alt="Photograph of green leaves covered in dew, Olympic National Park, Washington, photograph by Brent VanFossen" height="100" width="50">
No different from others, but I was thinking that if there was a way to get the location and the “photograph by” with a link to the image in a database, so I could somehow shorten the keystrokes…. Lorelle VanFossen and Brent VanFossen are a lot of keystrokes, folks. Anyway I could shorten these would be very cool.
Maybe just a pipe dream, I was just intrigued by the way the “wiki” Codex handled the images, I thought there might be a more efficient way of doing this.
Mark Ghosh’s Pictorialis I and II reads and displays the EXIF data from the digital image itself, assuming you are using digital photos, of course. You are really looking at adding some kind of dedicated photo gallery application to WordPress, Lorelle, because WP out of the box is not designed to be a photo gallery. This is why so many folks work to integrate Gallery or Coppermine. Have you had a peek at Simple PHP Gallery? That may prove useful to you. Really, there’s no sense in adding this to WordPress itself when other applications exist to do this exact thing. The challenge, however, is in getting those applications to live and work nicely with WordPress. Since they aren’t developed in tandem, there can be some fun getting it all to work as you want it to.
Thanks for the info, our moose friend. I really just want to store the information in a database rather than mess with the images….trying to save a few fingers, but I’ll look into the other stuff because I do need a good gallery, but this is a different issue.
‘You can’t store images in a database” – macmanx
The only reason I’m replying is because of this comment. You can store an image, or any file, for that matter, in a database. MySQL can store it in a binary “BLOB” column. It’s just typically slower, a coding pain, and good for very few uses. I’ll agree with every point here that it’s better to just upload a file. The only benefit I’ve ever heard of is when a hosting provider forgets to count your database size against your total storage space quota (rare).
For more info, here’s one link: http://www.liquidpulse.net/articles/php/images/storing_and_retrieve_images_from_a_mysql_database
- The topic ‘Calling images from database in WP?’ is closed to new replies.