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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:25:17+00:00 2026-06-17T09:25:17+00:00

First of all, javascript newb here and working on a little pet project to

  • 0

First of all, javascript newb here and working on a little pet project to try to get better at this. I am building an Image object

function Image (id, name, height, width) {
    this.id     = id;
    this.name   = name;
    this.height = height;
    this.width  = width;
}

The first order of business is writing the id and name which I can do.

var image = new Image(
    json.revision_images[i].id, 
    json.revision_images[i].OrgImageName,
    json.revision_images[i].galleryid
);

My next step is adding the height and width to each instatiation of the object, this is where I have a problem wrapping my head around the object concept.

I have a little function that is getting the natural height and width of the referencing thumbnail.

function checkImageDimensions (id) 
{
     var img = $("#" + id);
     naturalDimension = getNatural(img);
}

How do I go about assigning

this.height = naturalDimension.oHeight;
this.width = naturalDimension.oWidth;

to the object based on id?

  • 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-17T09:25:18+00:00Added an answer on June 17, 2026 at 9:25 am

    As kirugan said, Image is already an existing function in browser. Better rename yours. Apart from that:

    Store your image objects in a map, keyed by ID:

    var images = {};
    // somewhere
    images[json.revision_images[i].id] = new MyImage(
       json.revision_images[i].id, 
       json.revision_images[i].OrgImageName,
       json.revision_images[i].galleryid
    );
    // and
    function checkImageDimensions (id) {
       var naturalDimension = getNatural($("#" + id));
       images[id].width = naturalDimension.width;
       images[id].height = naturalDimension.height;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all I am new to javascript so this question might be stupid.
Hi All First of all I don't know Javascript, I got this script from
First of all, pardon my hacky code, I'm just trying to try this out
First of all this is what understand about arguments of a method: get(arg1, arg2)
I'm not a newb to JavaScript but this is my first foray into Acrobat
First of all, the only post ( calling-multiple-dopostback-from-javascript ) I found about this didn't
First of all, I'm not a javascript expert. I'm going crazy on trying to
First of all, this isn't for a keylogger, it's for an input in a
First of all there is probably a question like this already but i couldn't
First of all, apologize because I have seen some posts about this, but I

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.