Solved

Images not showing in WordPress

Posted on 2010-08-19
21
255 Views
Last Modified: 2012-05-10
Does anyone out here know Wordpress?  Here is the issue I am running into.

We have a site on a production server that works fine. You go to the home page and the images, ads, and facebook links are showing up perfectly. I am setting the site up on my local machine to test changes to the site. After I backup the DB I replace all http://www.domain.com with localhost. Once I do that the images do not show on my machine. If I restore the DB with the original URL the images show up, but obviously all my tabs and links direct me to production.

Please let me know if any one has any ideas on what the issue may be.
0
Comment
Question by:mrwarejr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 7
  • 6
21 Comments
 
LVL 2

Accepted Solution

by:
TravisT earned 250 total points
ID: 33478848
What are the paths to the images on the page?

Are they FQDN, Relative OR local to that machine ONLY?

If you use localhost, that woudl mena WordPress servers would need to have them physically on their machines.  I think you need to change that to a relative path, for example:

IMAGE URL
http://www.mydomain.com/images/image.gif

Relative URL From Home Page
/images/image.gif (not http://localhost/images/image.gif)



0
 

Author Comment

by:mrwarejr
ID: 33478878
The images are physically on the machine.  When I use localhost the images do not show.  If I change the DB to www.domain.com/imagepath the files showup.  I can not figure out why they do not show when localhost is selected.
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
ID: 33478882
Try using the IP of your local machine instead of 'localhost'.  They aren't handled exactly the same.
0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
LVL 2

Expert Comment

by:TravisT
ID: 33478900
Agreed....use the IP then....if they are using host headers, locahost will not work, for that matter, neither will the IP....you will need to use relative paths in order to make it work.
0
 

Author Comment

by:mrwarejr
ID: 33479008
I just tried to use the IP address and it did not work either.  What would you suggest next.
0
 
LVL 2

Expert Comment

by:TravisT
ID: 33479042
Then they are using host-headers.

Test with one image and use a relative path as I put in my example above.

Travis
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33479104
I have Wordpress 3 working on XP and it's using the machine name.
0
 
LVL 2

Expert Comment

by:TravisT
ID: 33479116
Ohhh....Xp....yeah...relative paths shoudl work then.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33479118
It's running on IIS5.1 with PHP 5.2.5 and MySQL 5.0.51 by the way.
0
 
LVL 2

Expert Comment

by:TravisT
ID: 33479142
Try with one image the relative path and report back.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33479171
When I 'View Source', Wordpress is taking the 'siteurl' from the database and prefixing all links with it.  'siteurl' is the server path to the directory with 'index.php'.  On my machine it is "http://dibsnxp667/Wordpress" with no trailing slash.
0
 

Author Comment

by:mrwarejr
ID: 33479188
I will try and report back
0
 
LVL 2

Expert Comment

by:TravisT
ID: 33479190
hmmmm......usually using a relative path permits this form happening.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33479266
My Wordpress blog on Linux hosting does the same thing, it prefixes all links with it 'siteurl'.
0
 

Author Comment

by:mrwarejr
ID: 33480101
Okay I think we have narrowed it down using Beyond Compare on a working and not working sql file.  This image shows the only difference between the 2.  Anyone have any ideas on this.
Widget-Issue.jpg
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33480553
I can't see any difference in the part that is visible.
0
 

Author Comment

by:mrwarejr
ID: 33480560
Sorry the only difference is the working one has http://www.domain.com and the non working one has http://localhost 
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33480636
As far as I know, I don't have a 'widget' on either of my Wordpress installations.  But as I mentioned above, all the links on my pages show the 'siteurl' prefixed to the urls for everything else.  'siteurl' is the first record in the 'options' table of the Wordpress database.  If you look at the "View Source" on your hosted version, you can see what I'm talking about.  If that record is different than 'siteurl', you probably need to make it match.
0
 
LVL 2

Expert Comment

by:TravisT
ID: 33480664
OK - do this for testing purposes.

Go to c:\windows\system32\drivers\etc\hosts

Add a line in that says this (where 12.34.56.78 = your IP address and www.domainname.com = the domainname you will be using):

12.34.56.78  www.domainname.com


Keep in mind this make your machine now think you are the server hosting this domain - to disable this after testing or when youa re ready to upload, put a # back in front of the line to comment it out.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33480665
What is working?  If the server for your external links are aware of the referring server, they may not work when they're not on the publicly available server.  I know that Google puts up funny ads in 'foreign' languages when I'm working on those pages on my own local server.
0
 

Author Comment

by:mrwarejr
ID: 33629281
Sorry for the delay.  I have been out sick from work.  Well this issue never got resolved and we have dropped the project so I will just spread out the points to all of you for your help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question