Solved

How can I have a png image file appear smmaller then its size?

Posted on 2011-03-14
4
292 Views
Last Modified: 2012-05-11
Hi, I'm just using html and jQuery for this.  I have a few images in png file.  It's made 4 times the size then I actually need because the person who make them think it would look better when it's sized to med and large size in the program.  How do I make it look about 25% of its original size?  In img tag?  Thanks
0
Comment
Question by:lapucca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Vampireofdarkness earned 500 total points
ID: 35135456
Get the dimensions of the image (ie- 600 x 400), divide those by 4.

<img src='image.png' width='150' height='100' />
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 35135460
did you tried giving specific height and width to that img?

<img src="" height="100px" width="100px"/>
0
 
LVL 9

Expert Comment

by:Vampireofdarkness
ID: 35135470
Failing that, if you MUST use jQuery, you could use something like

HTML: <img src='image.png' id='myimage' />

JS:
$(document).ready(function() {
  $('#myimage').css('height':($(this).height()*0.25),'width':($(this).width()*0.25));
});

Untested, but should work.
0
 

Author Closing Comment

by:lapucca
ID: 35135590
Thank you.
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This article discusses how to implement server side field validation and display customized error messages to the client.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question