Cache jpg

  • Unknown's avatar

    Hi, I have a piece of HTML code that runs in footer and displays a a jpg image. That image/jpg is on another server and changes on a regular bases perhaps every hour. WordPress is cacheing the image so the ones displayed are old, sometimes many days. How do I force it to not use cache for this image. The simple code is below.
    a href=’http://www.server.com/sattrack/0/ST-GM.html’>

    WP.com: Yes
    Jetpack: No
    Correct account: Yes

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Hi there! 👋🏼

    I checked your site widgets and the code you’re using.

    The current approach is good (the StaticMap.jpg?version=123456 part):

    <a href="https://www.driper.com/sattrack/0/ST-GM.html">
      <img class="alignnone" title="Click here to open in Google Earth track and position year to date" src="https://www.driper.com/sattrack/0/StaticMap.jpg?version=123456" alt="Screensaver Position" width="500" height="500" />
    </a>

    However, it’s manual, meaning you need to update the ?version=xxxxxx URL query parameter by incrementing it by one each hour. However, it’s inconvenient.

    This could be automated using some JavaScript code or even some plugins.

    💡 Using JavaScript and plugins is possible with the Creator or Entrepreneur plans.

    Alternatively, if you’re code-savvy, you could automate this using the WordPress.com REST API to update the widget:

    📖 Here’s the Getting Started guide: https://developer.wordpress.com/docs/api/getting-started/.

    I hope this helps!

  • The topic ‘Cache jpg’ is closed to new replies.