As you saw in earlier lessons, there is also the Upload/Insert menu of the Text Editor for posts (as always I’m using “posts” to mean posts or pages).
But before you go crazy with uploading from any of these spots, let’s take a moment and talk about how WordPress thinks about media fi les and organizes them. You’ll see that, when it comes to uploading, what matters is location, location, location.
WordPress organizes media fi les in two ways: the media library and galleries.
The media library is a list of every fi le you’ve ever uploaded to your site and from it you can access those fi les from anywhere on the site.
A gallery, on the other hand, lists only the media fi les associated with that gallery’s post.
What do I mean by associated? That’s where things get a little complicated. A media fi le becomes asso- ciated with a post by 1) being uploaded into WordPress through the Upload/Insert menu for that post or 2) having its fi rst insertion from the media library into that post (it can be inserted into other posts later, but will only be associated with that fi rst post).
Think of it this way: whenever you upload a fi le into WordPress, you’re uploading it into the media library. But if the upload is done through the Upload/Insert menu of a particular post, the fi le is also associated with that and only that post. This means that all media fi les necessarily are in the media library, but not all fi les are necessarily in a gallery.
Why have galleries at all? Why not just a media library? Galleries are useful because they group related fi les together for easier retrieval and also allow you to easily display sets of images — image galleries — with just a click of a button, a topic I cover in detail in Lesson 15.
You’ll sometimes see the term attachments used to refer to fi les that are in a gallery. It’s just another way of describing the relationship of certain media fi les to a post, and this relationship is used by plugins and customizations to do all sorts of cool things.
Understanding these relationships will not only help you think of ways to use media fi les in WordPress, but it will help avoid two common confusions:
I inserted a photo into a post but it doesn’t show up in the gallery.
That’s because you “borrowed” an image from the media library that had already been inserted into at least one other post, so it’s permanently associated with some other post.
I uploaded an image to a post for a particular use and now it’s also showing up in the gallery of images I created for that post.
Any image you upload to a post becomes part of any image gallery in the body of the post. If you don’t want this new image in the image gallery, you would need to upload it to the media library instead, insert it into some other post fi rst, and then insert it into the post you’re deal- ing with.
54586c11.indd 84
54586c11.indd 84 10/16/09 9:44:55 AM10/16/09 9:44:55 AM
85
Lesson 11: The Basics of Handling Media Files
The Upload/Inser t Menu
You saw the Upload/Insert menu when you explored the WordPress Text Editor, but look at it in detail now using Figure 11-2.
Figure 11-2
The title of this menu is important because it’s a reminder that it fulfi lls two functions, both of which are completely separate: uploading media fi les and inserting them into the post. You can upload media fi les and not insert them into the post, and you can insert media fi les that were previously uploaded.
The four icons represent four types of media fi les. From left to right (with examples of fi le types) they are:
Images (photos, graphics — jpg, gif, png)
❑
Video (swf, mp4, wmv, avi, mov, and so on)
❑
Audio (mp3, ram, and so on)
❑
Other Media (doc, ppt, xls, zip, and so on)
❑
If you forget which is which, you just need to mouseover one and you’ll see the name of it.
Click any of these icons and you get a popup screen where you perform the upload or insert functions.
I go into all the details of those screens in Lessons 12 and 13. For the moment, I want to show you the basic steps for getting an image into a post.
Inser ting an Image into a Post
The most common way you’ll add images is when you’re working on a post, so to demonstrate I’ll upload a photo as part of a post about a vacation package on the Island Travel site. I begin by locating the Image icon of the Upload/Insert menu that you saw in Figure 11-2.
54586c11.indd 85
54586c11.indd 85 10/16/09 9:44:55 AM10/16/09 9:44:55 AM
86
Part IV: Working with Media Content
Clicking that icon produces the popup window in Figure 11-3.
Figure 11-3
The photos are on my computer, so I can use the default From Computer tab.
I click the Choose button and up pops a browse window showing my computer. I locate the image I want, highlight it, and click the Select button (or whatever your browser displays), as shown in Figure 11-4.
Figure 11-4
At that point the browse window disappears and WordPress displays a progress bar for the uploading of the images. Depending on the size of the image it could take a little while. When it’s fi nished, you see a thumbnail of the image with a whole lot of options, as shown in Figure 11-5 (you’ll probably need to scroll to see all this, depending on the size of your screen).
Don’t worry about all those options right now. What I’m looking for is the Insert Into Post button down at the bottom left. I click that, the popup window disappears, and I see the image in the body of my post, as in Figure 11-6.
Remember to click the post’s Update button and you can click Preview to see what your image will look like on the live site.
54586c11.indd 86
54586c11.indd 86 10/16/09 9:44:55 AM10/16/09 9:44:55 AM
87
Lesson 11: The Basics of Handling Media Files
Figure 11-5
Figure 11-6
54586c11.indd 87
54586c11.indd 87 10/16/09 9:44:55 AM10/16/09 9:44:55 AM
88
Part IV: Working with Media Content
Try It
I’ve just run through the basics of uploading an image to a post and then inserting it, so for practice, try uploading to the media library fi rst and then inserting into a post.
Lesson Requirements
A post with text.
Step-by-Step
1. Find the Add New link under the Media section of the admin menu and click it.
2. Click Select Files.
3. In the popup window, choose the fi le to upload and click Select. You should see a progress bar for the upload. When the upload is complete, you’ll see a series of options.
4. Fill in any of the fi elds you choose.
5. Click Save All Changes.
6. Navigate to the post where you want to insert the image.
7. Click the Image icon of the Upload/Insert menu.
8. Click Media Library.
9. Locate the image you just uploaded and click Show.
10. Click Insert Into Post. You should see your image in the body of the post.
To see some of the examples from this lesson, watch the video for Lesson 11 on the enclosed DVD.
54586c11.indd 88
54586c11.indd 88 10/16/09 9:44:55 AM10/16/09 9:44:55 AM
The Upload/Insert Window Tabs
When you click one of the icons on the Upload/Insert menu and the window pops up, you see tabs in that window, and in this lesson you learn what they each mean. Briefl y, here’s what they do in order from left to right:
From Computer:
❑ This is for uploading fi les from your computer.
From URL:
❑ This is for creating links to fi les elsewhere on the Web.
Gallery:
❑ This displays a list of every media fi le (not just images) that has been uploaded to this post. They may not all have been inserted into the text, but they were all uploaded in WordPress through this post. This Gallery tab is also used to insert a thumbnail list of all images into the post.
Media Library:
❑ This is for inserting any fi les already listed in your media library.
The following sections cover each of these tabs in some detail.
The From Computer Tab
Because the From Computer tab is the one you’ll use the most, and it’s the default tab when the window opens, let’s start with it, as shown in Figure 12-1.
Figure 12-1
54586book.indb 89
54586book.indb 89 10/15/09 12:22:00 PM10/15/09 12:22:00 PM
90
Part IV: Working with Media Content
You’re told to “Choose fi les to upload” and the good news is that they really do mean fi les, so you can pro- cess many fi les at one time instead of having to choose them one by one. The not so good news is that this uploading system, which uses Flash, doesn’t always work on every browser. In fact, WordPress even tells you that and offers an alternative Browser Uploader link. So if you don’t see a Choose button, just click the browser link and you’ll get a regular upload function — only you’ll have to do it one fi le at a time.
As you saw earlier, the upload window displays a bar showing the progress of the upload, shown in Figure 12-2.
Figure 12-2
If you’re uploading multiple fi les, there will be a separate progress bar for each one, all running at the same time.
What you see after uploading is fi nished depends on whether you’re uploading multiple fi les or just one. If it’s several fi les, you’ll see a thumbnail for each fi le with a Show link, as illustrated in Figure 12-3.
Figure 12-3
54586book.indb 90
54586book.indb 90 10/15/09 12:22:00 PM10/15/09 12:22:00 PM
91
Lesson 12: The Upload/Insert Window Tabs
If you’re uploading just one fi le, you’ll get a larger thumbnail and a whole series of options (the ones you would see if you clicked the Show link for multiple fi les). These options will vary depending on the type of media fi le you’re uploading. I cover the options for images in Lesson 13, and the others I cover at points when I’m talking about that particular fi le type.
The one option shared by all screens is the ability to either Insert the fi le into your post or Save it for future use.
The From URL Tab
This is the place to insert media fi les that are located on a site other than your own. You may want to use this option in cases where you run multiple websites and have an image or document common to all, so you simply use the URL on all the sites. Another example is when a company whose product you’re sell- ing provides you with a URL to an image of the product — this is where you’d insert that URL.
You can’t just start grabbing images from anywhere — you need to have permis- sion to use the image, not just for copyright reasons, but because you’re using their server’s bandwidth to load the image.
As you can see in Figure 12-4, unlike the From Computer tab, you’re presented with all the options right up front.
Figure 12-4
Notice that the title says “Add media fi le from URL” and the options say “Image.” The reason for that is you’ll have different options in the From URL tab depending on which icon you chose from the Upload/Insert menu. In this case I had chosen the image icon.
54586book.indb 91
54586book.indb 91 10/15/09 12:22:00 PM10/15/09 12:22:00 PM
92
Part IV: Working with Media Content
I cover the details of each type of option in the lesson for that particular media type, but there is one option that’s the same on all From URL tabs, and that’s the URL box.
You’ll need the full URL for the media fi le in a form like this: http://www.somedomain.com/folder/
filename.extension. (The extension is the .jpg, .avi, .pdf, and so on.)
Type or paste that URL into the URL box. As soon as you move your cursor off that box, you’ll see a tiny spinning graphic to the left of the URL box. If WordPress successfully locates the fi le, you’ll see a green check mark — if not you’ll see a red X after a certain amount of trying. An example of each is shown in Figure 12-5.
Figure 12-5
If you get the red X, you’ll need to make sure you typed in the URL correctly (that’s why I prefer to copy and paste) or that you’ve actually copied the right URL.
You can usually get the URL by right-clicking an image, pdf, video, or other media fi le and selecting Copy Image Location (Firefox), or Properties and then highlight- ing the URL and copying it (Internet Explorer).
The other option that all From URL tabs share is the Insert Into Post button. It will remain grayed out until WordPress has confi rmed the existence of the fi le and given you the green check mark. At that point you can do the insert. There’s no Save function because you can’t put these fi les into the gallery or the media library.
Keep in mind that if you don’t have control over the URL where the fi le is located, it could disappear in the future without warning, so you’ll need to keep an eye on such fi les so your visitors aren’t left with broken images/links.
The Gallery Tab
You will not always see a Gallery tab when you click a button on the Upload/Insert menu. Only if there is at least one item already in the gallery will you see the tab. The number in the bracket on the tab title is the total number of media fi les in the post’s gallery — that’s all media fi les, not just images.
Figure 12-6 shows an example of the screen you get when you click the Gallery tab.
54586book.indb 92
54586book.indb 92 10/15/09 12:22:00 PM10/15/09 12:22:00 PM
93
Lesson 12: The Upload/Insert Window Tabs
Figure 12-6
The Gallery Settings area at the bottom is where you create image galleries for your posts, and I deal with that in Lesson 15. Right now, I’m focused on the top area, which, as I said, displays all media, not just images.
On the left-hand side you’ll see image thumbnails or icons representing other types of media fi les. On the right of each fi le is a Show link. Clicking that reveals all the options for the particular type of fi le, including the option to insert the fi le into the post. While the options are displayed, this link will say Hide — click it to hide the options.
There’s also the option at the top of the screen called All Tabs: Show, and by clicking that you’ll open the options for all fi les at one time. Just click Hide to close them all up again.
Next to All Tabs is a small menu called Sort Order and this is part of how you control the order of images when you’ve inserted an image gallery into a post — something I cover in Lesson 15 — so you don’t need to worry about it at this point.
The Media Library Tab
What you get in this tab is a quickie version of what you would see under Media ➪ Library in the main admin menu. It allows you to see every media fi le that’s been uploaded to your site and use it in the post you’re working on. An example is shown in Figure 12-7.
54586book.indb 93
54586book.indb 93 10/15/09 12:22:00 PM10/15/09 12:22:00 PM
94
Part IV: Working with Media Content
Figure 12-7
As you can see it’s very similar to the Gallery tab with the thumbnails on the left and the Show link on the right. If there are more than 10 items in the library, you’ll see pagination at the top right, allowing you to navigate through numerous screens of fi le listings.
Most of the time you’ll be working with images and if you click the Media Library tab, you might wonder where all your PDFs or other media fi les have gone. That’s because by default WordPress shows you only the fi le type you’re working on. You need to click All Types at the top right of the Media Library tab to see every fi le in the library.
From this tab you can not only insert a media fi le into your post, but you can change the options on those fi les whether or not you’re inserting them. Whether you change the options on one or more fi les, be sure to click Save Changes at the bottom left. It may or may not be visible depending on the height of your screen, so you may need to scroll down to see it.
I’ve been talking here about the Media Library tab, but in Lesson 19 I cover the media library itself, which you access from the Admin menu.
54586book.indb 94
54586book.indb 94 10/15/09 12:22:00 PM10/15/09 12:22:00 PM
95
Lesson 12: The Upload/Insert Window Tabs
Try It
In this lesson you practice inserting an image into a post using the From URL tab.
Lesson Requirements
An existing post and have in mind an image on your website that you’d like to insert into your post (or if you have permission for an image on another site).
Step-by-Step
1. Open a post for editing.
2. Click the image icon of the Upload/Insert menu.
3. Click From URL.
4. In a separate tab of your browser, fi nd the page with the image you want to insert.
5. Right-click the image and choose View Image or Show Picture — if neither is available, choose Properties and highlight the URL in the popup window.
6. If View Image or Show Picture works, you’ll see the image by itself in your browser — copy the URL in the address bar.
7. Paste the address for the image into the Image URL fi eld.
8. Click the Image Title or any other fi eld.
9. A small spinning circle displays beside Image URL, indicating it’s checking that your image is where you say it is.
10. If the image is found, you’ll see a green check mark.
11. If the image is not found, you’ll see a red X.
12. Assuming you get a check mark, choose an Alignment.
13. If you want the image to link somewhere, enter that URL in the Link Image To fi eld.
14. Click Insert Into Post.
15. Click Preview to see the image in your post.
To see some of the examples from this lesson, watch the video for Lesson 12 on the enclosed DVD.
54586book.indb 95
54586book.indb 95 10/15/09 12:22:00 PM10/15/09 12:22:00 PM