We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 43074
    • 6 Posts
    Hello,

    I have been tasked with moving an existing MODx-1.0.2 based site to another host. I have transferred all the files and amended the config.inc.php file. Created a new mysql database and imported the old sql data and changed all relevant paths I can find. However whilst the site displays OK it does not show any images. If I clear the cache and new pages are generated and all links appear to be valid and working. Frustratingly it is just the images that do not work.

    If I try to open the image by right-clicking and select open image in new tab. I get the following url:

    http://www.MYDOMAIN.previewdns.com/image.php?src=/assets/images/IMAGE-FILE-NAME.jpg

    this differs from the originally hosted site by the addition of the 'previewdns.com' , so the working url is:

    http://www.MYDOMAIN.com/image.php?src=/assets/images/IMAGE-FILE-NAME.jpg

    If I browse to my site the folder structure appears to be correct. The IMAGE-FILE-NAME.jpg is in images folder, which is in assets folder, which is in the root.

    If I manually enter a '.' into the url before /assets it works:

    http://www.MYDOMAIN.previewdns.com/image.php?src=/assets/images/IMAGE-FILE-NAME.jpg
    becomes
    http://www.MYDOMAIN.previewdns.com/image.php?src=./assets/images/IMAGE-FILE-NAME.jpg

    and displays the image.

    Apologies if this has been covered in another post. I have trawled for hours and haven't found the answer.
    Any pointers in the right direction would be very much appreciated.
      • 40092
      • 265 Posts
      Do you have your BASE url specified correctly? It sounds like you don't and then this can happen try putting it like this:

      <base href="[(site_url)]" />
        • 43074
        • 6 Posts
        Hello thapriest86,


        Thanks for such a quick response. I found mention of this in other posts, but being a complete novice wasn't sure which file this should be in. e.g. index.html / index.php / image.php.

        If I log in to the manager, and go to reports, system info it says MODX_BASE_URL /

        ?
          • 40092
          • 265 Posts
          You should have that in your main template file on top.
            • 43074
            • 6 Posts
            I found the default template and the first part reads as:

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml">

            <head>
            <title>[(site_name)] | [*pagetitle*]</title>

            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

            <link rel="stylesheet" href="[(base_url)]assets/templates/default/site.css" type="text/css" media="screen" />
            <base href="[(site_url)]" />


            when I preview the site and inspect the element it replaces the <base href="[(site_url)]" />

            with

            <base href="http://www.MYDOMAIN.previewdns.com/">

            so I think it is correctly specifying the base. Any other suggestions please?
              • 40092
              • 265 Posts
              The path to your images is not correct, not in this usage, anyway.

              The source for the image is
              src=/assets/images/IMAGE-FILE-NAME.jpg
              

              Wich is a basepath

              And your basehref is:
              <base href="http://www.MYDOMAIN.previewdns.com/">


              Adding the together would make:

              <base href="http://www.MYDOMAIN.previewdns.com//assets/images/IMAGE-FILE-NAME.jpg">


              Notice the double trailing slash here?

              Using the dot './' makes your path relative and is equal to :

              src=assets/images/IMAGE-FILE-NAME.jpg
              


              Notice the missing trailing slash here?

              Adding this to the base href should make te path correct.

              In short, you need to change the src for your image and lose the starting trailing slash and it will work. smiley
                • 43074
                • 6 Posts
                Hi, Thank you for your reply. I follow what you say but after a bit of further investigation I found that it only appears to be relevant to images which are presented using 'image.php'. Other images displayed without using image.php appear fine.

                I have compared both the working site and my non working copy, and using google chrome to inspect the elements both are letter for letter identical including the trailing slashes before assets/images/IMAGE-FILE-NAME.jpg.

                For clarification the working site shows <img src="/image.php?src=/assets/images etc and works with the slash before the word assets.

                The site uses the snippet phx:phpthumb and looking through these files it seems to say it needs the trailing slash in order to work.

                So in my limited understanding...

                I have been given the original site in a zipped format. I uploaded it and unzipped it so all files and relevant folders should be the same. After clearing the cache all content and pages are generated correctly ( albeit with the new domainname ), images embedded with the command img src="assets/images etc" display , it is only the image.php parts that do not work.

                The only differences I think there will be are:

                1. different host and global settings ? ( I found others mentioning magic quotes ON causing problems with some users of phpthumb - this appeared to make no difference)

                2. different directory structure ? I think that I must have this correct otherwise you cannot browse files via Elements > Manage files, and images display not using image.php.

                3. Possible different MYSQL Settings? Modx site appears to use character coding Unicode (UTF-8) on both New and old hosts, however new MYSQL host uses UTF, but old host Reports - System Info appears to show Database Charset Latin1 and Database Collation Charset Latin1_Swedish_ci.

                Rightly or wrongly I discount the SQL mismatch because the produced cached php files appear to be generated correctly... so I think there must be something to do with either the different host settings or directory structure.

                phpthumb appears to have numerous options. Is there a way to generate useful error?

                The best I can get is:

                "Resource interpreted as Image but transferred with MIME type text/html:"

                googling this suggests many causes including:

                - your suggestions of image path set incorrectly.

                - image is sent with wrong headers, add headers to image type via .htaccess

                - capital letters on imagenames

                So I think it is more specifically to do with the phpthumb settings ?

                Also I just remembered I had to set Validate HTTP_REFERER headers to NO in order to get the manager to work initially - Could this be the reason?

                Apologies for the long-winded post.
                  • 9995
                  • 1,613 Posts
                  did a quick read, did you renew the path at:

                  CMS > MANAGE? > CONFIGURATION > INTERFACE > PATH TO FILES

                  and check last tab too
                    Evolution user, I like the back-end speed and simplicity smiley
                    • 43074
                    • 6 Posts
                    hi fourroses666,

                    I am using modx 1.0.02 ( i know it's old - but it is what it was created with ).

                    I can only see options under Tools > Configuration. Under this there are tabs for Site , Friendly URLs, User , Interface & Features, File Manager. As far as I can tell I have updated anything with relative path.
                      • 43074
                      • 6 Posts
                      Hi,

                      I just thought I'd post an update. I updated the DNS settings so that the site was live and it worked. So for some reason www.mydomain.previewdns.com would not display images, however www.mydomain.com does.

                      Many thanks for the suggestions.

                      Gary