Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter richo67

    (@richo67)

    To be precise, the url in srcset attribute of img tag generated by function the_post_thumbnail() are not modified to be relative.

    Is there a way to fix it?

    Plugin Author Sparanoid

    (@sparanoid)

    Hi richo67,

    Sorry for the inconvenience, it’s not easy to fix this issue, if you look at the source tab of your post editor, you’ll see the image URLs are hardcoded. However this plugin does replace the site URLs by invoking wp_make_link_relative so hardcoded URLs cannot be changed by this plugin.

    Plugin Author Sparanoid

    (@sparanoid)

    Here’s a good news for you, I just updated this plugin with a new approach to replace links. now all links should be relative even in your dashboard. please check it out, feedbacks are always welcome.

    Thread Starter richo67

    (@richo67)

    Hi Tunghsiao Liu,

    I tried your new version, but there has not been a change. Here i put a little code so you can see in which part the url is not replaced. This img tag is created by calling the_post_thumbnail() function. every url in scrset is not modified by your plugin.

    <img width="50" height="50" src="/wp-content/uploads/2010/07/2010-07-14-17822.web_-50x50.jpg" class="postThumb wp-post-image" alt="Strobist workshop with David Tejada" title="Strobist workshop with David Tejada" srcset="http://www.richard-vanek.eu/wp-content/uploads/2010/07/2010-07-14-17822.web_-150x150.jpg 150w, http://www.richard-vanek.eu/wp-content/uploads/2010/07/2010-07-14-17822.web_-100x100.jpg 100w, http://www.richard-vanek.eu/wp-content/uploads/2010/07/2010-07-14-17822.web_-50x50.jpg 50w, http://www.richard-vanek.eu/wp-content/uploads/2010/07/2010-07-14-17822.web_-120x120.jpg 120w" sizes="(max-width: 50px) 100vw, 50px" />

    I have also noticed that url in feed are modified too (which is not good) so I have to add following lines at the start of the function which replace the url (done this in your 0.0.13 version.

    if ( is_feed() || get_query_var( 'sitemap' ) )
            return;

    Plugin Author Sparanoid

    (@sparanoid)

    Which version are you using? in latest v0.1.0 I got the following output on my localhost:

    <a href="/wp/wp-content/uploads/2015/06/cropped-IMG_1227.jpg" rel="attachment wp-att-3837"><img src="/wp/wp-content/uploads/2015/06/cropped-IMG_1227-300x300.jpg" alt="cropped-IMG_1227.jpg" width="300" height="300" class="alignnone size-medium wp-image-3837" srcset="/wp/wp-content/uploads/2015/06/cropped-IMG_1227-80x80.jpg 80w, /wp/wp-content/uploads/2015/06/cropped-IMG_1227-300x300.jpg 300w, /wp/wp-content/uploads/2015/06/cropped-IMG_1227-50x50.jpg 50w, /wp/wp-content/uploads/2015/06/cropped-IMG_1227-270x270.jpg 270w, /wp/wp-content/uploads/2015/06/cropped-IMG_1227-192x192.jpg 192w, /wp/wp-content/uploads/2015/06/cropped-IMG_1227-180x180.jpg 180w, /wp/wp-content/uploads/2015/06/cropped-IMG_1227-32x32.jpg 32w, /wp/wp-content/uploads/2015/06/cropped-IMG_1227.jpg 512w" sizes="(max-width: 300px) 100vw, 300px" scale="0"></a>

    My original site url is http://localhost:8888/wp/.

    Thread Starter richo67

    (@richo67)

    I tried both 0.0.13 and 0.1.0 and it seems be working in 0.1.0 as you wrote, but I have issue with W3 total cache plugin.

    It certainly make relative path in feed and that is wrong.

    I wanted to use your plugin to avoid issue when my site is viewed over https as some of the link still points to http, which breaks downloading of some css and js files.

    I wanted to have all links root relative so they will pick up http or https.

    Unfortunately I am getting sort of chaotic results.
    -r-

    Plugin Author Sparanoid

    (@sparanoid)

    Just updated 0.1.1, things to test:

    1. URLs in feeds
    2. If it works with W3 total cache

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘url of images in post not made relative’ is closed to new replies.