• Resolved mzimmers

    (@mzimmers)


    OK…so I have my theme selected. Just as a test, I tried inserting some HTML code to insert an image. Comes up as a blue “?”. I’ve verified that the image is web-ready, and have even put it in the same directory as the index.php file (where the reference is)…no luck. What am I doing wrong?

    Thanks…

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter mzimmers

    (@mzimmers)

    Update: I discovered that when trying to display an image file, the “default” pathname is to the wordpress directory, not to the directory the “calling” php file is in.

    1. am I correct in this?
    2. are there any variables that point to the image directory for the current theme? It wouid seem to be cumbersome to have to hard-code the pathname.
    3. is this a bug or a feature?

    Man, you upload an image from the Write panel.
    When it’s done, it appears there as a thumb. Clcik on it. You have Options:
    Original
    Thumb

    and Linked to Orig/Image or Page or Not linked

    There is also an option “SEND TO EDITOR”. Click it. The correct code should be in your content area where you write your text…

    What is so complicated?

    Thread Starter mzimmers

    (@mzimmers)

    But, from the Write panel, I can only upload image within the context of creating a post or a page, right? What if I want to just upload a bunch of images for later use?

    Also, I believe it was you who suggested that working locally, then uploading the work. That’s what I’m trying to do here. Using the method you gave above seems to violate that philosophy (unless I’m missing something else).

    You can upload a bunch of them and they will be there when clicking on Browse All.
    You can also upload them via FTP but then you will not see them to select to be sent to editor.

    I said to edit the template files locally. I don’t think I said anything about writing/editing the content.

    Thread Starter mzimmers

    (@mzimmers)

    OK, that’s good information…thanks. Not to pick nits, but in this particular case, it is a template file (specifically a header file) that I’m trying to add the image to. I don’t see how to do that with the Write panel.

    Or, are you saying that if I create a dummy page and do an upload, the image(s) I upload will then be available for an “<img” call in my header file?

    Oh, no!
    Sorry, I misunderstood – I thought you are talking about inserting images in posts…

    Images for themes should be in the wp-content/themes/theme-name/images folder. I am sure your theme also has something similar. If not, create one.

    If you are calling it in the header.php then you should use this code:

    <img src="<?php bloginfo('stylesheet_directory'); ?>/images/your-pic-name.jpg" alt="whatever" />

    By this your image will always be displayed, no mattaer what page you are on.

    Thread Starter mzimmers

    (@mzimmers)

    OK, thanks, Moshu…I’ll try that. I’m sorry that my problem description wasn’t clearer; I’ll try to do better from now on.

    I guess that one mistake I was making was using a plain HTML construct to try to display the image, rather than the PHP you showed.

    Also, are you sure that I want that “/” before “images?”

    Thanks…

    Actually, not a mistake, you can use “plain” html and the full (aka absolute) path to your images, but since they are (or should be) in the theme’s subdir anyway… that WP code and its siblings make it easy: your style sheet is in the theme directory > so it will call/get the URL up to that point
    example.com/wp-content/themes/yourtheme-name

    so, yes, you have to add: /images/image-file-name.jpg to get the correct path.

    Thread Starter mzimmers

    (@mzimmers)

    Success! Thanks, Moshu. I’ll mark this resolved, and start a new thread when I hit my next obstacle (which probably won’t be too far ahead).

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘can’t reference an image file?’ is closed to new replies.