Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Regardless of what you're doing, having multiple options for completing the task at hand is a good thing. When it comes to placing images on the page, you have plenty of options to choose from in Dreamweaver. In this movie, we'll examine different methods for getting images onto your webpages and discuss the pros and cons of each one. To do that, I'm going to use two files this time, so I have the index.htm file open and I have the spotlight.htm file open. You can see, when you've got multiple documents open in Dreamweaver, you get tabs up here and I can just tab back and forth between those two.
And that's from the 07_03 folder. So the first thing I want to do is show off placing images onto the page using the Assets Panel that we covered a little bit earlier in the chapter. So I'm going to scroll down on the index page until I find the article down here about Victor Stuesse winning the Lacie Award. Now you'll notice that I'm in Design View but I'm not in Live View. In order to make changes on the page and place images on the page, Live View needs to be turned off. So I'm going to make sure I'm looking in Design View. I'm going to go over to the Assets Panel, and what I want to do is I want to scroll down through my assets until I find award.
Now you may notice that we have two of these displaying and that may trip you up at first, but the way that our Exercise Files are structured, we have a finished_files folder, and I'll show that to you. I'll go over to the Files Panel. You see we have finished_files which contains the duplicate of the Exercise Files in a finished state and you can see it also has an images directory with all our images in it as well. So what the Assets Panel is showing you is, it's showing you all the images in a defined site, not just a specific folder, so that's why we're seeing two.
But you want to make sure you're using the right one, so what I'm going to do is I'm going to take my Panel Dock here and I'm going to expand it out a little bit and you can see that as I expand it out, I get the full path of the images over here as well. So I want to make sure I'm using the one in the images directory, not finished_files, and for me, that is the top one right here. So I'm going to do award.jpg. Okay. So with that one selected, what I'm going to do is I'm literally just going to drag-and-drop it right on the page right in front of the word Victor. So I can just drag it from the Assets Panel to the page, place it where I want it, and let go.
As soon as I do that, Dreamweaver is going to prompt me for some alternative text and I'm just going to type in Victor Stuesse and then I'm going to click OK, and it places the image right on the page. Now that was fairly simple, but there's another way that you can drag-and-drop images on the page as well. So I'm going to undo that, Ctrl+Z or Command+Z, flip over to the Files Panel, and this time I can go straight to the images directory, find the file I'm looking for; in this case, award.jpg, and I can drag-and- drop that one as well right onto the page.
Once again, it prompts me for some alt text. As soon as I enter that in, there's my image. Both of those methods work exactly the same. The only difference of course is that in the Assets Panel, I get to see a little bit more about the image, I get to see a thumbnail, that sort of thing. In the Files Panel, I just see the list of the images. All right! I'm going to save this file and while dragging-and-dropping is extremely easy, it's so easy just to drag something over, drop it on the page where you want it and boom! Your image appears, but the biggest problem with this is that as your layouts get more complex, it's a lot harder to drag something into a precise location.
Indeed, there are some instances where it's almost impossible. Let me show you what I mean. I'm going to switch over to spotlight. htm, and in the spotlight.htm, our first image which is going to be of the student, Gerald Chow, even though the image is going to show up on the right-hand side, the image itself needs to show up in front of the Student Spotlight div tag. That may seem a little odd, but the way I've done the layout in terms of the floats, it really sort of demands that the image be placed there. I also don't want to place the image inside the div tag because the div tag has a white background which basically needs to bud up against the image.
If the image goes inside that div tag, it's basically going to expand the height of the div tag and the illusion of that container is going to be ruined. So to drag the image to the left- hand side of this element is pretty much impossible because I have a couple of items sitting on top of this div tag and the Design View is not rendering it really all that well. So it's going to be very, very difficult for me to do that through the use of drag-and-drop. But one of the great things about Dreamweaver is there's always an alternate method of doing something if one particular technique doesn't work.
First, let me show you how to precisely position your cursor, where you want to place an object. You can see that I have the student div tag selected. The easiest way to do that, just click inside of it, and then go down to your tag selector and once again, click only the div.student tag. It should highlight the entire div tag and you should see the outline all the way around it. Well, once you have an element selected, you can use your Arrow keys to move your cursor to the immediate right or to the immediate left of an element. So what I'm going to do is I'm going to hit my Left Arrow key.
That's going to move my cursor over before that element. Now what's really odd about this in terms of the way Dreamweaver is displaying this, is the cursor looks like it's just sort of blinking right there in front of the S, but in reality, your cursor is just to the left of the entire div tag. So this is more really of a rendering error than anything else. You just sort of have to trust it. Now of course once you place your cursor in a precise location like that, it's really important not to click on the document itself or hit any of your Arrow keys. You want to make sure that the cursor stays right there. Okay, I'm going to go over to my Assets Panel, I'm going to open this up again, and what we're looking for this time is the chow.jpg file.
Now I'm going to click that once to highlight it and I'm going to use the top one because it's the one from my images directory, not the finished_files. And when I select this, this time instead of dragging-and-dropping it, I'm going to right down to the bottom of the Assets Panel and I'm going to click the Insert button right there. So if you have your cursor in a location where you want your image to show up, you don't need to worry about trying to drag-and-drop it. All you need to do is click the Insert button and it's going to place the image on the page. Now I'm just going to go ahead and do a quick alt tag here, Gerald Chow, and the image shows up. Notice that it comes on the left-hand inside and it is before that div tag.
As a matter of fact, you could switch to Split Screen View, and you could verify that that the image is indeed coming before the div tag. Now if it didn't work out for you, just undo it and try it again and just double-check to make sure that you're selecting the div tag not inside the div tag and that you hit your Left Arrow key. Now we're going to have another opportunity to practice this again because I'm going to show you another way to get an image on the page without using the Files Panel or the Assets Panel. So I'm going to undo that, I'm going to switch back over to Design View, and once again, I'm going to click inside the div tag and then I'm going to click the div tag itself and then I'm going to click my Left Arrow.
Again, that's the easiest way in Design View to place your cursor in a very precise location within the code. Now the next thing, I'm going to do is I'm going to go up to my Insert toolbar which is right up here up top and depending on your workspace, it may be docked above your CSS Styles Panel. You can always go to Window>Insert to open it up if you don't see it. And there's a little category of objects right here in the middle of the Common objects and it deals with images. Now, if I grab that pulldown menu, the first option there is to insert an image on the page. Now the thing that I like about this technique versus using the Assets Panel or the Files Panel itself is that when I do this, I get the option to browse for that image.
Now in addition to browsing for the image which allows you to go to the precise location that you're looking for, there are some other things going on here that I want to point out to you. First, I'm going to scroll down and find the chow.jpg. Notice that as soon as I select this, I get to go down here and see how it's going to resolve the URL. What I mean by that is I get to see the path where it's going to point to this image from the file I'm currently in. I could also change whether it's a Document or a Site Root relative link. Now for the most part, that's not going to be that important to you, but if you're working with certain blogging platforms or certain types of content delivery networks, being able to do a Site Root relative path is actually pretty nice.
And finally, the last thing here that I want to talk about is being able to use Data sources. So what's really nice about this is if you had a database of images and you wanted to pull, let's say I had 15 different students within a database somewhere, I could click on the Data sources, tell it where to go, and have it bring in a dynamic image on my page, which is really cool and that's something that you cannot do using the Files Panel or the Assets Panel. So I'm going to go ahead and click OK. It's going to again prompt me for an alt tag, I'm just going to type in Gerald Chow one more time and I'm going to click OK.
Now if you're still having trouble because I've got to tell you, it's a little tricky sometimes to place your cursor in that exact location, there's even an easier way to do that, and the easiest way to do it is simply just go to the code. If you go into the code and you find where you want to place an image, let's say for example that I go down to say, Line 35, there's a little break in the code here, and this is where the first feature image needs to go, I can click my cursor directly on the line of code or anywhere between tags of where I want this image to go. You can see how difficult it would be.
If I went in Design View, the image needs to go somewhere inside this gray box. But if I click inside this gray box or try to use my Arrows as I click around inside of it, it becomes really, really difficult to do. So the easiest thing to do is simply go into Split Screen View or Code View, place your cursor exactly where you want your image to go, and then you could use one of the techniques that we've used before or you could also go up to Insert>Image, so that's yet another method. Again, this method also gives you the browse functionality, and again, I could scroll down, find the feature1 .jpg that I need to go here.
Again, this is going to prompt me for an alt tag, so I'm just going to type in thataway which is the name of the piece of art and I'm going to click OK, and there's my image. So it places it directly in the code where I want and you can see on screen it's being placed where I need it to as well. So I'm going to go ahead and save this file. Now you may not utilize all of the techniques that we described here in terms of the different types of methods that I've given you for placing images on the page. But it's worth noting the strengths of each one of them so that you can use the technique that best fits your current situation.
Having choices is a good thing, and thankfully, Dreamweaver provides plenty of those when placing images on the page.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.