Solved

Drupal images do not display

Posted on 2013-01-04
25
608 Views
Last Modified: 2013-01-21
I am a stone-cold beginner to Drupal. I have done some reading on the Drupal website and have seen some tutorials. I have a general sense about how Drupal works, but that’s about it.

I have been asked by a client to do some work on their Drupal site. The site is currently fully functional and well-behaved. I am told it is running Drupal 6. I have downloaded the site and database to my PC. I am using WAMPSERVER64 (Apache v 2.2.17, PHP v 5.3.3 and MySQL v 5.1.52) and want to do my testing and development locally before messing with the production site.

I have been able to get the website home page to display correctly, except there are several images which do not display. You can go to http://www.claim-il.org/ to view the page and follow along. On that page you will see 3 photos. None of these pictures display locally. Also, at the bottom of the page, you will see a purple text box with a Donate button. The button does not display either.

When I view the source code sent to the browser, I see that the file names for the 3 photos all have special characters (spaces, underscores or brackets) in their names. They are all also located in the same directory (/sites/default/files/images).

When I display the home page in my test site, the URL is http://localhost/claim/index.php. I have tried setting the $base_url to http://localhost/claim in /sites/default/settings.php, but it did not resolve the problem.

Since I downloaded the site from a working version, I suspect it is a local setting of some kind. Where do I go from here?
0
Comment
Question by:gpinzino
  • 13
  • 8
  • 3
  • +1
25 Comments
 
LVL 13

Expert Comment

by:Arrow_1
ID: 38745954
Are you running your site in a sudirectory on your local machine? Something like http://localhost/mysite ? If so, the site is looking in the wrong place for the images. It is looking in localhost/sites/default/images. In this case, the fix would be to edit the pages and insert the correct paths.
0
 
LVL 16

Expert Comment

by:HagayMandel
ID: 38746286
Assumption: You do have a sub directory '/files/images/' in your default site (at 'sites/default', and that sub folder contains all the files as the one in the production site. If not, you must copy the files as well!
Look at the source code, and check the path of those images as rendered by Drupal. You'll be able to detect the erroneous path.
0
 
LVL 1

Author Comment

by:gpinzino
ID: 38746895
Arrow_1 and HagayMandel,
You are right that Drupal is looking in the wrong place. As I mentioned, I changed the $base_url setting to http://localhost/claim, but it has had no effect. The rendered page does not direct the browser to the claim subdirectory. The settings file I found is in sites/default/. Am I in the right place? What do I do to fix this?
0
 
LVL 16

Assisted Solution

by:HagayMandel
HagayMandel earned 100 total points
ID: 38747040
Check out the Public file system path (Administration » Configuration » Media) and make sure it points to your files sub directory.
Again, check the rendered code to find out the actual path Drupal is looking at. I don't know hoe these images were uploaded (a node content, an image field) but the actual rendered  path. is the key to the answer.
Check the 'file_managed' tab;e in your database, and see under uri column where files are located. If it's 'public', then your Public file system path is not right.
0
 
LVL 1

Author Comment

by:gpinzino
ID: 38751220
I am tempted to raise this as a separate question, but my guess is that the current question and my new issue are related, so I will raise it here and hope everything is resolved in a single solution.

I cannot access anything other than the index (home) page. If I click on any menu link, I get a 404 error. For example, if I click on Services>Legal Services, I get the URL "http://localhost/claim/legal-services" and the 404 error message.

Also, if I try to go to localhost/claim/user or http://localhost/claim/?q=user, I get a 404 error, so I cannot even log in to admin. What now?
0
 
LVL 1

Author Comment

by:gpinzino
ID: 38755874
This problem of not being able to access anything but the home page seems to be fairly common. The complaint shows up on the Drupal Community page http://drupal.org/node/1654. It was suggested that the .htaccess file was missing. The file was, in fact, missing from my setup.

I could not find the .htaccess file on the client's website, so I tried adding the .htaccess file from the Drupal6 installation package. No luck. The problem persists. I have attached the file for your review. Could there be an issue with the .htaccess file settings?
.htaccess.txt
0
 
LVL 16

Expert Comment

by:HagayMandel
ID: 38756933
I get the URL "http://localhost/claim/legal-services" and the 404 error message.

Now what happens if you omit the '/claim' from the url?
0
 
LVL 1

Author Comment

by:gpinzino
ID: 38757596
HagayMandel,
The issue with not getting other pages, appears to be a problem in the .htaccess file related to clean urls. I found a suggestion on the Drupal community site to add "$conf['clean_url'] = 0;" to the end of the settings.php file to suppress clean urls. Now, it looks like I can access all pages on the site.

However, I still cannot access admin, nor do the images display correctly. Right now, I am highly confident that localhost/claim is the correct base url. If you have any further suggestions on how to regain access to admin or what should be changed in .htaccess to fix the clean url issue, they would be welcome. In the meantime, I will continue my efforts as well.
0
 
LVL 17

Expert Comment

by:nanharbison
ID: 38763743
On the .htaccess file, did you try changing the rewrite base? These lines are near the bottom of the file.

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal

Also, whenever the images are where they are supposed to be and I can't see them it's because I have forgotten to set the page input type to full html.
0
 
LVL 1

Author Comment

by:gpinzino
ID: 38764536
Yes, I have changed the RewriteBase, but it has not fixed anything. As I said earlier, I have made the setting to turn off clean URLs and I can get to the other pages on the website, but still no images from the media folder. It seems obvious to me that I have some bad settings somewhere. They talk a lot in the Drupal community about problems with .htaccess, but I have not found specific code to fix the issue.

I'm also stuck on the access to admin. I can get to the user login page by using http://localhost/claim/index.php?q=user and I can log in, but when I click on administer, I get the message in IE that it cannot display the webpage. In Firefox, it says the connection was reset. Again, it sounds like a configuration issue. I am using the superuser login, user1, so I don't expect it to be a permissions issue.
0
 
LVL 17

Expert Comment

by:nanharbison
ID: 38764629
In Drupal 6, there are references to the URL in many places. Did you try to go through the database and do a find and replace?
So replace:
http://www.claim-il.org/

with:
 http://localhost/claim/
?
This doesn't happen in Drupal 7, which is a HUGE improvement.
0
 
LVL 17

Expert Comment

by:nanharbison
ID: 38764638
Or, I just thought of this. Does the working website have the module installed called backup and migrate? You could install it on the site, and then create a back up, then do a clean installation on your development server and make sure you install the backup and migrate module, and migrate it to your site.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:gpinzino
ID: 38764727
Two excellent suggestions. I'll give them a try and report back tomorrow.
0
 
LVL 1

Author Comment

by:gpinzino
ID: 38768094
I went through the entire database and fouond URLs only in the files table. They are relative addresses, beginning with "sites/". Adding "claim/" to the beginning of the image addresses had no effect.

Alos, I took a look at the backup and migrate module. It only backs up the database, which I have already done. I don't think that will help here.

I am posting the issue on the Drupal community site. If I get any resolution to the problems, I will post it here.
0
 
LVL 17

Expert Comment

by:nanharbison
ID: 38768384
But did you use the restore function in the backup and migrate module on your development site, using a backup made by the module in the working site?
0
 
LVL 17

Expert Comment

by:nanharbison
ID: 38768391
I think perhaps the most recent updates to the backup and migrate module have removed all absolute references to pages, which is great.
0
 
LVL 1

Author Comment

by:gpinzino
ID: 38768416
Correct me if I am wrong, but I believe the backup and migrate module backs up only the database. I used phpMyAdmin to export and import the database. I believe I have an accurate copy of the database. Do you think it will do any good to try it again using backup and migrate? The module is not on the production site, and I am reluctant to do anything on the site without testing it first.
0
 
LVL 17

Expert Comment

by:nanharbison
ID: 38768684
The name of the module includes migrate. I have used it to migrate to new servers and I have never had a problem with it. It is a very common module. Does the live website have a way to keep the site backed up on an ongoing basis? I always set up back up and migrate on sites and have it make backups as often as the website users think they will be making changes, once a month, or once every few days. It's a good module. Does the live site have any custom modules on it? If all the modules are regular Drupal modules, the backup and migrate module is perfectly safe.
0
 
LVL 1

Author Comment

by:gpinzino
ID: 38770136
Thanks, I'll give it a try.
0
 
LVL 17

Expert Comment

by:nanharbison
ID: 38770241
If you are worried about it, backup the live site database using PHPMyAdmin or something first. But I use this module on every single site I have installed for clients to make regular backups of their site.
0
 
LVL 1

Author Comment

by:gpinzino
ID: 38779913
Well, it has been an interesting experiment to implement backup and migrate. Apparently, to be able to backup and migrate files in addition to the database, a second module, backup and migrate files, is required, plus the Archive_Tar class in PEAR. I won’t bore you with the painful details, but it looks like I need a PEAR file called Tar.php to place in the backup_migrate_files/includes directory.

When I followed the instruction in the backup and migrate files README file, I wound up with an xml file called Archive_Tar-1.3.3. I added that file to the includes folder under the Archive_Tar-1.3.3 filename as well as under the Tar.php name.

The backup function backs up the database as expected, but no options to back up the files show up. Dreamhost says a basic PEAR implementation is included on the server. I must be missing something, but I do not know what it is.
0
 
LVL 1

Author Comment

by:gpinzino
ID: 38784006
Today, I tried a fresh download of the database and files with basically the same results. Still needed to modify settings to access other pages, reset the base URL and turn off clean URLs. I also had to modify the default .htaccess file to change the RewriteBase.

I still have the same issues.
0
 
LVL 17

Accepted Solution

by:
nanharbison earned 400 total points
ID: 38784067
Did you install the database using the Backup and Migrate module? I think  that is key.
0
 
LVL 1

Author Comment

by:gpinzino
ID: 38801314
OK. I took my chances and made the changes directly on the production server, and held my breath. Fortunately, it worked. This is my second failed attempt at setting up a CMS locally. These tools are not as easy to use as their developers would have you believe.

I am awarding points based on your contributions to the effort. Thanks for your help.
0
 
LVL 1

Author Closing Comment

by:gpinzino
ID: 38801328
While a final solution to the issues was not found, I learned a lot from the many helpful suggestions from the experts.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Apache HTTP to HTTPS redirect please. 5 38
Increase size of permitted URI 4 40
PHP Register global 21 64
LINUX CENTOS + APACHE 9 36
This article is for those that are having major problems with users upload files such as pictures to their profile. The solution is simple and has to do with correcting the directory paths. With some experimenting and testing i got it fixed. Note…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now