• hey there!

    I like the plugin, had a few hicups that I was able to resolve in my custom configurations. However one thing I can’t solve (mostly because I’m having a hard time reading the code :p) is that when you have the thumbnail of the featured post, the plugin uses the site address instead of the wordpress address to pull the url for the thumbnail.

    So for example, my site thegeekycoder.com (not promoting, it’s live, you can see the bug right now) has the site address set to the root / of my domain. However, for organization reasons I’ve placed the blog files in a blog/ subdirectory, and used the rewrite rules provided for wordpress to link them.

    The problem happens when the plugin tries to reference example.com/uploads/someimage.jpg, which is wrong because the physical location of the file on the file system is actually example.com/blog/someimage.jpg.

    I’d say that this is a pretty easy fix, and I tried to do it myself however I’ve had hell trying to find where you set the image’s url, so I’m posting here in hopes of a fix or some directions to fix it myself.

    tyvm for the plugin, it’s done everything I’ve wanted it to do… Except this :).

    https://www.ads-software.com/plugins/advanced-featured-post-widget/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author tepelstreel

    (@tepelstreel)

    Hey there!

    Cheers that you like tha plugin. And I don’t really know how to help you, I have to admit. It feels like a couple of 100,000 years ago that I wrote the routine how the plugin gets the images.

    But as far as I remember, it goes as follows:

    1. Is there a thumbnail? Yes? Take it’s ID and display the source in the appropriate size.

    2. No thumb? Never mind, get the first attached image of the post, get it’s ID and display the source in the appropriate size.

    3. No thumb, no attachment… Well, let’s see… Oh, there are images in the post or a gallery or whatever. let’s get an ID and display the source in the approrpiate size.

    4. Nothing really works, but I have an URL of an image. Let’s just display that in the appropriate size.

    So, my guess would be that all the URLs of the images in your database are without the /blog/ in between and that’s why the plugin fetches them.

    I hope it helps somehow.

    Best

    Plugin Author tepelstreel

    (@tepelstreel)

    Forgot to mention. It all happens in the A5_ImageClass::thumbnail function.

    Plugin Author tepelstreel

    (@tepelstreel)

    This is how an image tag, I found on your site looks like:

    <img class="img-responsive wp-image-158 size-full" width="700" height="525" sizes="(max-width: 700px) 100vw, 700px" srcset="https://www.thegeekycoder.com/blog/wp-content/uploads/2015/01/Cats-bread-slices25-300x225.jpg 300w, https://www.thegeekycoder.com/blog/wp-content/uploads/2015/01/Cats-bread-slices25.jpg 700w" alt="I am TOTALLY ok with this." src="https://thegeekycoder.com/wp-content/uploads/2015/01/Cats-bread-slices25.jpg">

    Notice the src? No blog there. And that’s what the plugin gets. Not sure why actually. Becaus it looks at the srcset at one point… But as I said, I a little bit forgot over the time what happens in particular when getting an image.

    Thread Starter lawhorkl

    (@lawhorkl)

    Hi!

    As I can see, there is a blog there but that’s not what it shows on my front page. That image tag would work because the url is correct, however the url of the image on the front page excludes it. Thank you for the directions, if I figure it out I’ll send you to code so you can look at it and merge it in. I’m sure more people would like this as well.

    Plugin Author tepelstreel

    (@tepelstreel)

    Hi!

    Where is a blog? I meant that part of the code:

    src="https://thegeekycoder.com/wp-content/uploads/2015/01/Cats-bread-slices25.jpg"

    In the srcset there is the blog:

    srcset="https://www.thegeekycoder.com/blog/wp-content/uploads/2015/01/Cats-bread-slices25-300x225.jpg 300w, https://www.thegeekycoder.com/blog/wp-content/uploads/2015/01/Cats-bread-slices25.jpg 700w"

    And the src is what the plugin gets, not the srcset. That seems to be the problem here.

    I found the code snippet in that blog post.

    I guess, if you get the Search & Replace plugin and let it run over the database replacing

    https://www.thegeekycoder.com/wp-content/

    with

    https://www.thegeekycoder.com/blog/wp-content/

    you’ll have the problem solved.

    The reason, why you see images now is that you have a browser that can deal with the srcset.

    I hope that helps.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘plugin using site address instead of wordpress address to serve images’ is closed to new replies.