Images Not Seen When FTP’d to New Directory in WordPress

WordPress is designed to look for images in an uploads folder inside the wordpress install. If called-for images are not there, they don’t show up on your WP pages. Simple as that.

Right below the section in WP where you make your post entries, there is a section called Upload. You can browse to a file on your computer, select it, enter a title and description and by clicking Upload, said file will be transferred to the uploads folder.

Caution: The upload function merely uploads the file, with its given title and description, but it does not put said file into any post until you use the img tag to specify its placement.

What if you’d like to use FTP to upload images directly from an image editor program? I prefer to use a separate file transfer program so that I can bulk transfer several images at one time. Once my images and files are optimized for the Web I’ll use an FTP program to transfer them all at once.

How to assure you’re transferring files to the right directory so they’ll be seen on your Web pages? Check your absolute and relative path names.

Posts that use relative urls may or may not work fine, but the same relative url on a category page or archive page probably won’t work at all. I came across this discrepancy where images in my posts were visible, but the same images (which I knew were definitely there) did not show up on the same posts when viewed via category pages or archived pages. The relative path could not find the images one level up.

Using an absolute file path to the image will definitely work on posts, pages, archive pages and so on. For a local WP install on my Windows Vista, I use absolute filenames like so, http://localhost/wordpress/img/image-filename.jpg, and for WP installed at the root of a Web domain like so, http://domain.com/img/image-filename.jpg .

Using FTP to upload images to an images directory is pretty easy. FTP is a feature of many design programs and several free or shareware standalone FTP programs are available on the Internet. Features are similar across the board. Basically, you drag files or images from the local side of your screen (left) over to the server-side of your screen (right), or highlight the files to upload and click a right-pointing-arrow to move the files from your local machine to your server.

Much faster than using a browser to upload files, FTP is a handy tool that no webmaster can do without. What FTP program do you like to use and why?

Image Default Location for WordPress

Posting images in WordPress is easy enough, but you have to know the path the the image directory for the images to appear in your posts. Duh!

Using a local install of WordPress for developing new themes I tried to add an image folder to the theme directory of the current theme. Images did not appear in the posts. That makes sense because the images in posts are independent of the theme you are currently using. Changing a theme for the blog’s look would require using a different theme directory and therefore, it would make no sense to use the current theme directory to store images for the entire blog.

A suitable location for WP images is a new directory inside the wordpress directory in htdocs when running XAMPP, not inside the WordPress theme directory.

With an image directory called “img” the relative path to images would be img/filename.jpg for example.

The path on my machine is C:\xampp\htdocs\wordpress\img\filename.jpg.

The properties of a displayed image show http://localhost/wordpress/img/filename.jpg as the image’s url.

Images for posts cannot be found with Firefox using relative addresses, at least on my local XAMMP setup on Vista Home Premium. Instead, use the absolute URL for images placed in your own image folder in the wordpress directory.