473,809 Members | 2,709 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Shrink image size when browser size is reduced

Is it possible for an image to SHRINK (both height and width, keeping same
h/w ratio) when the browser's width is reduced? It's easy to have both h & w
increase, as needed, to fill up 100% of the <td>, but I don't see how to
have the image shrink.

Without JavaScript, the standard seems to be scrollbars when the browser
shrinks. I'd like the picture to shrink in size and avoid the scrollbars.
Jul 23 '05 #1
4 6902
Bob Richardson wrote:
Is it possible for an image to SHRINK (both height and width, keeping same
h/w ratio) when the browser's width is reduced? It's easy to have both h & w
increase, as needed, to fill up 100% of the <td>, but I don't see how to
have the image shrink.
Percentages my friend, percentages.
Without JavaScript, the standard seems to be scrollbars when the browser
shrinks.
Only for those that know no better, and that may indeed include me.
I'd like the picture to shrink in size and avoid the scrollbars.


And what exactly does this have to do with Javascript?

<img src="someImage. gif" width="100%">

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2

"Randy Webb" <Hi************ @aol.com> wrote in message
news:k9******** ************@co mcast.com...
Bob Richardson wrote:
Is it possible for an image to SHRINK (both height and width, keeping
same
h/w ratio) when the browser's width is reduced? It's easy to have both h
& w
increase, as needed, to fill up 100% of the <td>, but I don't see how to
have the image shrink.


Percentages my friend, percentages.
Without JavaScript, the standard seems to be scrollbars when the browser
shrinks.


Only for those that know no better, and that may indeed include me.
I'd like the picture to shrink in size and avoid the scrollbars.


And what exactly does this have to do with Javascript?

<img src="someImage. gif" width="100%">


The above is exactly how I've coded the HTML. I think the IMG is 700 pixels
wide. When you expand the size of your browser beyond 700, the picture's
width and height both expand. But when the browser's width is less than 700,
the picture does not shrink. Just scroll bars.

Thus, I thought that perhaps a JavaScript function might work to reduce the
size of the image.
Jul 23 '05 #3

"Bob Richardson" <bobr at whidbey dot com> wrote in message
news:Fs******** ************@wh idbeytel.com...

"Randy Webb" <Hi************ @aol.com> wrote in message
news:k9******** ************@co mcast.com...
Bob Richardson wrote:
Is it possible for an image to SHRINK (both height and width, keeping
same
h/w ratio) when the browser's width is reduced? It's easy to have both h
& w
increase, as needed, to fill up 100% of the <td>, but I don't see how to
have the image shrink.


Percentages my friend, percentages.
Without JavaScript, the standard seems to be scrollbars when the browser
shrinks.


Only for those that know no better, and that may indeed include me.
I'd like the picture to shrink in size and avoid the scrollbars.


And what exactly does this have to do with Javascript?

<img src="someImage. gif" width="100%">


The above is exactly how I've coded the HTML. I think the IMG is 700
pixels wide. When you expand the size of your browser beyond 700, the
picture's width and height both expand. But when the browser's width is
less than 700, the picture does not shrink. Just scroll bars.

Thus, I thought that perhaps a JavaScript function might work to reduce
the size of the image.


Ah, I see that it shrinks nicely in Firefox, but not IE 6 :(
Jul 23 '05 #4

Hey Bob, did you ever find a solution to this problem? I'm havin
trouble with this one myself.. I've found a few links that claim t
have a solution, but when I try them, they either don't work or I ge
an error message. (I'm assuming I'm doing something wrong, as I a
fairly new to Javascript.)

I would think there would be more information out there on this kind o
thing. I wish I had a way to create dynamically resizeable image conten
without always resorting to Flash. :

--
Malkalyps
-----------------------------------------------------------------------
Malkalypse's Profile: http://www.highdots.com/forums/member.php?userid=2
View this thread: http://www.highdots.com/forums/showthread.php?t=7047

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
18344
by: BashiraInTrouble | last post by:
Hi Friends, I have tried almost everything but I cant seem to shrink the transaction log. Executing DBCC SQLPERF(LOGSPACE) gives me this info: Database Log Size (MB) Log Space Used (%) Status MY_eems 368.49219 16.034182 0 I made a complete backup of the database and transaction log and then executed this statement: DBCC SHRINKFILE (MYeems_log, 1)
4
6733
by: Tommy.Vincent | last post by:
hi all, This will be a easy question for all out here. I have a database of 28GB. having 3 Data Files 22 GB, 3.58 Gb and 2.70 GB respectively. and a Transaction Log file of 156 mb. When i executed DBCC Shrinkdatabase(databasename),it reduced size of datafile but the LOG file had gone up to 5 Gb from 156mb.
14
11105
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a window.open function? I would prefer not to create a separate HTML page. So far all I have is the basic var cwin = window.open('images/KJV-THANKS.gif', 'Thanks', 'width=243,height=420,'); cwin.focus();
12
6194
by: Sharon | last post by:
I’m wrote a small DLL that used the FreeImage.DLL (that can be found at http://www.codeproject.com/bitmap/graphicsuite.asp). I also wrote a small console application in C++ (unmanaged) that uses the DLL above. Now the application, together with the above DLL’s is successfully loading a TIF image file (62992 x 113386 Pixels, Huffman RLE compression, 3200 x 3200 DPI resolution, binary colored (1 Bit Per Pixel), file on disk size 43.08...
5
1816
by: Mark | last post by:
I'd like to automate the process of shrinking .jpg files using C#. I'd like to point at 1000 files, shrink them to 30%, and then resave the new files. I've seen the Graphics.DrawImage method, but this appears to be used for display only? What classes/method would be most useful? Thanks in advance. Mark
4
3487
by: Doug van Vianen | last post by:
Hi, I have the following coding on a web page. It causes two pictures (pic1.jpg and pic2.jpg) to show, one above the other and then when one clicks on the top picture is squeezes to the left (as its width is reduced) to show the bottom picture. Then when the bottom picture is clicked the top picture expands to the right to cover the bottom picture again.
12
11775
by: hallpa1 | last post by:
Hi all, I posted messages before about trying to purge many records (about 35%) of a 200Gig database. The responses gave me a lot to think about, especially regarding the indexes. But due to the short windows that I have to run in, manipulating the indexes is not an option. But this leads to another question. When all of this is done, we will need to shrink the db to reclaim the space. We will also need to rebuild the indexes, but...
11
9582
by: Parrot | last post by:
Is there any routine I can call to reduce the size of an image file after uploading a file from a client. I am looking to reduce file sizes programmatically using C# in my web page after uploading. I know that Photoshop can do it but I need to do it dynamically in my web page. I tried doing it myself with some of the Bitmap thumbnail instructions but the resulting image is very bad. I need a file reduction routine that creates a good image...
11
5826
by: shapper | last post by:
Hello, I am displaying an image on a few pages. The image size is 50 px height and 50 px width. In some pages I need the image to be 30x30 px in others 40x40 px and in others 50x50px. Can I scale the image using CSS? Thanks,
0
9602
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10383
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10120
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.