Help get this topic noticed by sharing it on Twitter Twitter, Facebook Facebook, or email.
Steve Hurst

Wygwam stripping site URL from Upload Directory URL

In order to get site uploads and images to work across subdomans (for translated and mobile-based sites), I have to set a full path within each of my file upload locations. I've noticed both Wygwam and NGen File Field strip out the site URL from my setting, leaving only the absolute path.

For example:

http://site.com/images/uploads/

becomes just:

/images/uploads/

within all of my template tags.

Is it doing this because of a settings somewhere in the system that I've missed, or is it common practice for Fieldframe or other extensions to ignore the full URL? I can't get my subdomain-based sites to load any images associated with custom fields or Wygwam fields without them printing the full URL in the output.

This is on EE1.7.1, Fieldframe 1.4.5 and Wygwam 2.3.4.1
1 person has
this problem
+1
Reply

  • Hi Steve,

    The only thing Wygwam should be doing with your upload directory URLs is replacing everything up to the actual filename with a {filedir_X} tag, so that if your upload directory URL setting ever changes, your Wygwam fields are already up-to-date.

    Where are you seeing the site URL getting stripped out?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • Steve Hurst
    Hey Brandon,

    I first noticed it in my ngen file fields. Regardless of what I change the URL to, whether it's http://google.com/images/uploads/ or my actual site's domain, it strips out everything before the first folder slash on all of my template tags. I hacked their extension to get it to print the full URL, as I found a statement in their code that was looking for a'full_url' setting (see below). Without that setting, the default was to return a trimmed URL.

    Then I got the idea to check how Wygwam was handling the same file upload settings, and the same thing occurs within the content tags. Anything prior to the first folder slash is cut. Which led me here, assuming this was a setting somewhere in EE that was causing both extensions to behave similarly.

    I know this isn't your code, but maybe it will give you a clue. This is from ft.ngen_file_field. I couldn't find anything similar in the Wygwam module, regardless of not wanting to hack either module to get this to work.


    // If full_url param is set to yes, return full URL w/ hostname etc
    if(isset($params['full_url']) && strtolower($params['full_url']) == 'yes') {
    $file_url = $this->upload_prefs['server_url'] . $file_name;
    $r = $file_url;
    } else {
    //$full_file_path = $upload_prefs['server_path'] . $file_name;
    $file_uri = $this->upload_prefs['server_uri'] . $file_name;
    $r = $file_uri;
    }


    Thanks so much for the extremely fast response!
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned