Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9009647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:15:23+00:00 2026-06-16T02:15:23+00:00

So what I have is the following HTML structure <div class=large> <a href=http://www.google.com> <img

  • 0

So what I have is the following HTML structure

<div class="large">
<a href="http://www.google.com">
<img src="/wp-content/themes/firstone/mythumb.php?src=http://www.example.com/test.jpg&h=600&w=800&zc=1&s=1" width="800" height="600" border="0" /></a>
</div>

Now that mythumb.php is a thumbnailer script that will on the fly create a thumbnail with predefined size limits (in this case 800×600).

However in my CSS file i’ve set

.large img
{
width:400px;
height:300px;
}

This is done so I achieve a retina effect on iphones/ipad, etc..

However, I was thinking this is better to be accomplished dynamically, and I want to be able to pull the CSS defined width and height and replace those values in the URL

In this case, would it be possible for javascript to change

/wp-content/themes/firstone/mythumb.php?src=http://www.example.com/test.jpg&h=600&w=800&zc=1&s=1

to

/wp-content/themes/firstone/mythumb.php?src=http://www.example.com/test.jpg*&h=300&w=400*&zc=1&s=1

This change should occur before the image loads so we dont waste the users bandwidth downloading the same image twice.

I would also like to only apply this to images being called from the mythumb.php, not my other static images on the page

Does anyone think something like this is possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:15:25+00:00Added an answer on June 16, 2026 at 2:15 am

    in html layout your img tags, but omit a src attribute

    <img id="test" class="variableRes" />
    <img id="test1" class="variableRes"/>
    

    in js set up an array of your image paths:

    myImages = {
        test: "/wp-content/themes/firstone/mythumb.php?src=http://www.example.com/test.jpg",
        test1: "/wp-content/themes/firstone/mythumb.php?src=http://www.example.com/test1.jpg"
    }
    

    Your css determines the img sizes, so you can query the img style, build the url and assign the src to the img tags

    $('.variableRes').each(function(){
        var $el = $(this);
        var id = $el.attr("id");
        var height = $el.css("height").substr(0,-2);//strip "px"
        var width = $el.css("width").substr(0,-2);
        $el.attr("src", myImages[id] + "&h="+ height +"&w="+ width+"&zc=1&s=1");
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following html structure: <div class=divClass> <a class=aClass href=#> <img src=xxxx.jpg <span
I have the following HTML structure: <div id=settings-choose> <a href=#setting1 class=setting-tab> <div class=content> <div
I have the following HTML structure: $('#subgroup a').nextUntil('h3').wrapAll('<div></div>'); <script src=https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js></script> <div id=subgroup> <h3>Group name
i have following HTML structure: <div class=container> <div class=sidebar></div> <div class=content></div> <div class=subscript></div> </div>
I have the following html structure: <div class=container> <div class=header></div> <div class=sidebar></div> <div class=content-loading></div>
I have the following HTML structure <div class=store><a href=#>GERMANY</a></div> <div class=store_details> <p>Stores in Germany</p>
I have the following html structure: <div class=event tiny> <a href=/whatever>Something</a> </div> And I
I have the following html: <div class=container> <img src=.../> <p>Heading</p> </div> I want this
I currently have the the following HTML structure: <div class=article-preview> <h1><a href=>Title</a></h1> <a class=pic-link
I have the following HTML structure: <div id=ctr__Wrapper class=wrapper> <div id=ctr class=control clickable> <img

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.