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 8085849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:15:41+00:00 2026-06-05T18:15:41+00:00

I have a page with an image, and two options: Show image full browser

  • 0

I have a page with an image, and two options: Show image full browser height or witdh.
i’m changing image src with javascript(image resizing is trough php).

Now if ill switch from height to width – new image is smaller and everything works. But when i’ll try to switch to width(new image is bigger), chrome loads new image, and changes it, but does not change image size. Image has changed – watermark that php places, changes and chrome inspertors shows that new image is actually bigger.

Markup is like so:

<div class="big-image" rel="52">
   <span class="thumbnail" style="float: left;">
    <img src="#IMAGE_URL#">
   </span>
 </div>

With other browsers than crhome, everything works.

Javascript code is here:

function setViewType(type) {
    type = type || getViewType();
    Session.set('album_view_type', type);
    $('.album-type').removeClass('disabled');
    $('#album-type-'+type).addClass('disabled');

    if (type == 'width') {
            $('.actions').css({
                'opacity': '0.3'
            });
    } else {
        $('.actions').css({
            'opacity': ''
        });
    }

    var $img = $('.big-image').find('img');
    $img.attr('src', $img.data('src_'+type));
}

Okay, found a solution:

var $img = $('.big-image').find('img');
var img = new Image();
img.onload = function () {
    $img.attr('src', $img.data('src_'+type)).css({
        'width': this.width,
        'height': this.height
    });
};
img.src = $img.data('src_'+type);

Still open to cause of the problem.

  • 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-05T18:15:42+00:00Added an answer on June 5, 2026 at 6:15 pm
    var $img = $('.big-image').find('img');
    var img = new Image();
    img.onload = function () {
        $img.attr('src', $img.data('src_'+type)).css({
            'width': this.width,
            'height': this.height
        });
    };
    img.src = $img.data('src_'+type);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two copies of same image map on page. They have different ID's,
I have a page on a site that's supposed to show an image for
I'm looking to have a full page image with a section of the image
I have a search textbox and two image buttons on a page I created
I have a page with an image. When you hover over the image, a
I have a page with an image. I want the client to be able
I have a custom list, and I've added a 'Page Image' field by clicking
I have web page i want that image should laod fast using preloader and
I have a page having a background image for <body> . The image may
I have a page that uses a background image to do rounded corners, and

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.