make upload folder in different domain

Discussion in 'General PHP' started by Singha, Dec 30, 2017.

  1. Singha

    Singha New Member

    Joined:
    Dec 29, 2017
    Messages:
    4
    Likes Received:
    1
    Hi,

    I'm working on a setup with two different webid installations:

    - one on the main domain to show the classic theme for desktop users
    - one (slightly modified) on the subdomain 'm' to show a (modified) version of the modern theme to mobile users

    Both installations share the same database and the mobile detection is done by Cloudflare.

    Works fine, only the upload folder gives me headaches...

    The mobile installation should point to the upload folder of the desktop one. I tried to change common.php but without result, it keeps pointing to the mobile version.

    The url of the desktop upload folder is: /home/xxxxxx/chokedee.ga/uploaded

    So the generated links should look like:

    (LINKS REMOVED)


    Anyone has an idea how to do this?
     
    Last edited by a moderator: Jan 23, 2018
  2. Singha

    Singha New Member

    Joined:
    Dec 29, 2017
    Messages:
    4
    Likes Received:
    1
    To the mod: I tried to remove the links in the previous post as I see now it is against the rules, but it did not work. Pls feel free to remove them if needed..
     
  3. Singha

    Singha New Member

    Joined:
    Dec 29, 2017
    Messages:
    4
    Likes Received:
    1
    In the mean time, I solved the problem but now I face something strange with the lightbox: on the mobile version, the images load perfect if you use a computer, but not at all on a telephone, which is quite essential on a mobile version. No problems with the desktop version.
     
    david62311 likes this.
  4. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,133
    Likes Received:
    242
    I recommend clicking on the report on your post #1 and then make the request to have the links removed. This way it will be flagged and get the admin's attention easier. It is a good idea to remove the links. Posting links in this forum can attract unwanted guests to your site.
     
  5. Box Lot

    Box Lot Super Moderator Staff Member Developer

    Joined:
    Dec 18, 2008
    Messages:
    2,621
    Likes Received:
    165
    Moderator note:
    Please start a new thread for each request. It is also helpful if you add solutions even if you yourself find them so that others who may experience the issues can benefit.
     
  6. Singha

    Singha New Member

    Joined:
    Dec 29, 2017
    Messages:
    4
    Likes Received:
    1
    As you will use two different themes with the same database, change the terms 'theme' and 'siteurl' in the theme files you will use for your mobile site into something else (like theme_m) and siteurl_m). This will automatically create two new database tables.

    Define the paths for the mobile site in common.php to reflect the changes

    //define the paths

    $root = $_SERVER['DOCUMENT_ROOT'];
    include($root."/home/xxxxx/desktopsite.com/");

    define('MAIN_PATH', $main_path);
    define('CACHE_PATH', MAIN_PATH . 'cache/');
    define('INCLUDE_PATH', MAIN_PATH . 'includes/');
    define('PACKAGE_PATH', MAIN_PATH . 'includes/packages/');
    define('UPLOAD_FOLDER', '/home/xxxxxx/desktopsite.com/uploaded/');
    define('UPLOAD_FOLDER_GALLERY', 'http://desktopsite.com/uploaded/');
    define('UPLOAD_PATH', UPLOAD_FOLDER);
    define('IMAGE_CACHE_PATH', UPLOAD_PATH . 'cache/');

    include INCLUDE_PATH . 'errors.inc.php'; //error handler functions

    As it is a while ago I did this, I might have forgotten some steps, but this is basically how it works.

    But as I said before: it causes a strange error with the gallery only if you use a telephone (only tested on android): the pictures don't load but if I load the mobile site on a pc, it works perfect...

    In html the code of a gallery picture looks like:

    <img class="img-rounded img-responsive center-block" src="http://m.mysite.com/getthumb.php?w=400&fromfile=/home/xxxxx/mysite.com/uploaded/17/o_1c2u3r7u61lqo1faf7d0dl61k08a.jpeg" border="0" align="center" height="300px">
    </div>

    -
     
    Last edited: Jan 31, 2018

Share This Page