Fancy Images, can it use relative links?

resolved (15 posts) (2 voices)

  1. avatar12
    Member

    Running into a small issue with the requirement of the fancy_images to use a full URL.

    Is there anyway to tweak this shortcode so that it can recognize relative URLs?

    instead of the full, http://mydomain.com/wp-content/uploads/etc etc

    Use just

    wp-content/uploads/etc etc

    Thanks!

    Posted 10 months ago #
  2. Elliott
    Support

    Hello avatar12,

    Which version of Awake are you using? Are the images not displaying when used with absolute path?

    Posted 10 months ago #
  3. avatar12
    Member

    1.3

    The shortcode doesn't register anything if I don't use the full (http://) path. No spinning icon, not even a placeholder... it is like the image and the code are not there at all.

    Posted 10 months ago #
  4. Elliott
    Support

    If possible then send us a link to your site so we can take a closer look. There have been cases where weird characters such as "~" mess up the resize script.

    Posted 10 months ago #
  5. avatar12
    Member

    I picked our oldest post to do an example for you, I can leave this up for a few hours.

    http://www.townsandtrails.com/mount-jefferson-from-the-great-gulf-and-a-meteor-shower-too/

    Look at the bottom of the post. I have two samples setup. The first one with the full URL works as expected. The second one, with a shorter absolute/relative (not sure I know the difference) URL does not work. If you inspect the site's html with firebug or view source, it is like the shortcode is not even there. It never registers.

    Posted 10 months ago #
  6. Elliott
    Support

    There is supposed to be an image underneath this text, (Example with short URL (wp-content/uploads/2011/07/Loon-rain1.jpg):), and it is not displaying correct?

    Paste the code that you used here.

    Posted 10 months ago #
  7. avatar12
    Member

    the code that works

    [fancy_images]http://www.townsandtrails.com/blog/wp-content/uploads/2011/07/Loon-rain1.jpg[/fancy_images]

    The code that doesn't work

    [fancy_images]wp-content/uploads/2011/07/Loon-rain1.jpg[/fancy_images]

    Posted 10 months ago #
  8. avatar12
    Member

    I put a few other tests up there on that same page, just so you can see that it behaves similarly with different versions of the truncated URL. As best as I can tell, anything that doesn't include an http:// will not be recognized.

    Posted 10 months ago #
  9. Elliott
    Support

    Alrighty, well as long as the absolute paths are working fine then it shouldn't be an issue.

    Is there a specific reason you need to use relative URL's?

    Posted 10 months ago #
  10. avatar12
    Member

    It is impossible to run a fully functional local copy for testing purposes without it.

    Not a game killer, but a pretty big inconvenience when I am developing sites for others.

    Posted 10 months ago #
  11. Elliott
    Support

    For a local copy try this,

    http://localhost/images/1.jpg

    The main thing is the "http://" part, we do a regex check for it.

    Posted 10 months ago #
  12. avatar12
    Member

    That definitely works, but then when I copy content over to a live server - or vice versa - I would have to change all of those shortcodes.

    I typically stage a site locally before going live with it. Or will sometimes pull a live site down to work on it locally. I think this is a pretty typically work flow. But I may be wrong about that.

    If there isn't an easy fix or workaround... I can make due.

    Posted 10 months ago #
  13. Elliott
    Support

    I'm not too fluent on regex syntax but open up /wp-content/themes/awake/lib/functions/shortcode.php and on line 548 you should see this,

    if(preg_match_all('!http://.+\.(?:jpe?g|png|gif)!Ui',$content,$matches)){

    You can try changing it like this,

    if(preg_match_all('!.+\.(?:jpe?g|png|gif)!Ui',$content,$matches)){

    I'm not sure if that will work or not but we can try.

    Posted 10 months ago #
  14. avatar12
    Member

    That seems to do it!

    Can you think of any downside to making that change?

    Posted 10 months ago #
  15. Elliott
    Support

    None that I know of, it is just taking off the "http://" test. If you start to see weird behaviour with your fancy_images then change it back when you go live.

    Posted 10 months ago #

Reply

You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme