0

I have taken a clone of my site, downloaded the files folder and the database to my local system.

I am using Xampp server in my local system and I have kept the site image ‘files’ folder in the sites/default/files directory.

The problem is that in my local system 30% of the images are not displaying in the local site. The images are available in the files/images folder, but in local site the images are not showing.

I tried all the process and i also updated the base url in my setting.php file but the issue is not yet fixed.

According to my understanding the issue is related to the image path. In site those images we are calling through css is not taking the site base url. For example:

Current path: http://www.localhost/sites/default/files/images/mobile-block-img-new.png

Correct path: http://www.localhost/repliconwebsite/sites/default/files/images/mobile-block-img-new.png

Please suggest if you get the solution.

  • Have check you public file system path in Configuration >> Media >> file system? – vgoradiya Sep 22 '15 at 10:36
  • @ Vimal Goradiya , Yes i checked, this is my public path "sites/default/files" – Sachin Tonte Sep 22 '15 at 10:54
1

As you are using subdirectory structure at localhost and previous drupal installation was at root directory, the base url will not change for database entries.

Use Pathologic module to change base url of urls coming from database

or

search n replace them in .sql file, then import the database.

search: src="/sites/default/files/images

replace: src="/repliconwebsite/sites/default/files/images

  • I kept my sites/default/files folder in root of the server"htdocs folder", so now images are coming but it is not a solution.. – Sachin Tonte Sep 22 '15 at 14:20
  • Careful with a search and replace on a dump file. You can destructively change serialized text blobs with matching text but not update the appropriate string length values. If you go this route, check out interconnectit.com/products/… Both WP and Drupal use serialized data structures. – Screenack Sep 23 '15 at 2:09
  • 1
    Better use pathologic module – Vishal Patil Sep 23 '15 at 5:56
  • Plus 1 for pathologic, great module, takes a little working out the configuration. However I don't think it'll work for images from image fields (it's a text input filter so only works for images uploaded into text fields). For that I'd consider putting an alias or symlink (or whatever the windows equivalent is) in place so that sites/default/files/images points to /repliconwebsite/sites/default/files/images saves you hacking the db. – bloke_zero Sep 23 '15 at 8:15
0

First of all check, whether your files are in sites/default/files/ folder or /sites/all/themes/your_theme/images/ folder ? If your files are in sites/default/files/ folder, You need to change permission and it is not right place to put your images. You should put images in your /sites/all/themes/your_theme/images/ folder and in Src attribute of image tag give path from sites/all/themes/your_theme/images/mobile-block-image.png path.

  • my images exist in sites/default/files/ folder, generally we kept all the images here only,in themes/image folder we kept only site related images. my issue is In site those images we are calling through css is not taking the site base url. and those images we are calling directly in the node images are coming properly – Sachin Tonte Sep 22 '15 at 12:35
  • my problem is same like this drupal.org/node/445522 – Sachin Tonte Sep 22 '15 at 12:38
  • From where you are uploading your images? – Viraj Sep 22 '15 at 12:51
  • manually i am keeping images in to files/images folder, its working at live and other 4-5 live other servers, but only in local images are not appering but images exist in folder, css images is taking this path localhost/sites/default/files/images/mobile-block-img-new.png but my correct path is localhost/repliconwebsite/sites/default/files/images/… – Sachin Tonte Sep 22 '15 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.