473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

geting hold of image???

hi,
i've asked this question before and didn't get an answer...maybe i didn't
explain it well so i'll try again...
--------------------------------------
main.html
i'm calling popUp like
window.open('/path/pic.jpg','popUp','toolbar=no, location=no etc.')
now...all pics don't have the same width and height so i don't wanna fix
manualy width and height for each pic...
--------------------------------------
popUp.html
instead i would like to write a function in the popUp.html that resizes the
window, but i don't know how to get hold of pic object so i could extract
width and height of individual pic...
<script lang=jscr>
picWidth=?
picHeight=?
</script>
--------------------------------------
thank you
Jul 20 '05 #1
4 1654
riki wrote on 06 feb 2004 in comp.lang.javascript:
hi,
i've asked this question before and didn't get an answer...maybe i
didn't explain it well so i'll try again...
--------------------------------------
main.html
i'm calling popUp like
window.open('/path/pic.jpg','popUp','toolbar=no, location=no etc.')
now...all pics don't have the same width and height so i don't wanna
fix manualy width and height for each pic...
--------------------------------------
popUp.html
instead i would like to write a function in the popUp.html that
resizes the window, but i don't know how to get hold of pic object so
i could extract width and height of individual pic...
<script lang=jscr>
picWidth=?
picHeight=?
</script>
--------------------------------------
thank you


define the container measurements
and give the pic style width and height of 100%

[This could disproportionalize the pics]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
LJL
"riki" <ri******@hotmail.com> wrote in news:bv**********@ls219.htnet.hr:
hi,
i've asked this question before and didn't get an answer...maybe i
didn't explain it well so i'll try again...
--------------------------------------
main.html
i'm calling popUp like
window.open('/path/pic.jpg','popUp','toolbar=no, location=no etc.')
now...all pics don't have the same width and height so i don't wanna
fix manualy width and height for each pic...
--------------------------------------
popUp.html
instead i would like to write a function in the popUp.html that
resizes the window, but i don't know how to get hold of pic object so
i could extract width and height of individual pic...
<script lang=jscr>
picWidth=?
picHeight=?
</script>
--------------------------------------
thank you


Have you thought of using a function call that sends the width and height
of the image? I get the idea that you want the function to figure out the
height and width automatically, but I think you need to load the image to
get that info (I may be wrong on that, but I don't know how it would be
done). You do, however, already know the image's actual size and name.

In other words, if the window.open function is called "open_new()", and you
know the size of the images you want to show, just do this:

The HTML looks like this:

<IMG SRC="thumbnail001.jpg" WIDTH="80" HEIGHT="60"
onClick="open_new(400,300,'bigimg001.jpg');">

or

<A HREF="javascript:open_new(400,300,'bigimg001.jpg') ;"><IMG
SRC="thumbnail001.jpg" WIDTH="80" HEIGHT="60"></A>

The JS looks like this:

function open_new(imgwid,imght,imgname) //width, height and name are sent
{
imgwid+=40; // adds 40 pixels in width - adjust as needed
imght+=60; // adds 60 pixels in height - adjust as needed
window.open(imgname,'_blank','width='+imgwid+',
height='+imght+',directories=0,menubar=0,resizable =1,scrollbars=0,status=0,
toobar=0');
}

Good luck, LJL
Jul 20 '05 #3
i was wondering if it's possible to get hold of image object in popUp.html?

i dont know, something like this

window.document.XXX

and XXX represents image object...if it's possible than i could extract
exact width and height so pic wouldn't get disproportionalized...
Jul 20 '05 #4
> Have you thought of using a function call that sends the width and height
of the image? I get the idea that you want the function to figure out the
height and width automatically, but I think you need to load the image to
get that info (I may be wrong on that, but I don't know how it would be
done).


i'm working with about 100 pics and i thought that i could avoid manually
fixing width and height for every pic.
but it seems that i'll have to do it harder way .
the idea was to get hold of image object in popUp window after it was
load...
popUp.html
-------------------------
<body onLoad="javascript: getImage();">

but my efforts failed :)))

anyway, thank you for your answer...i'll try to do it your way
Jul 20 '05 #5

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

Similar topics

6
by: lostinspace | last post by:
After four+ years of using FrontPage in a limited capacity and having created over 600 pages on my sites, I've finally (at least for the most part) abandoned FP, to begin the process of converting...
3
by: Gary B | last post by:
I'm converting a windows application to a web application. (by the way, this is way easier than it used to be - many of the modules went over untouched!) The windows app used a pictuebox and...
2
by: Lau Lei Cheong | last post by:
Hello everyone, I was believing that the life of ASP.NET objects will end as soon as the origionating Page object transmitted the response stream and frees, even if you haven't explicitly free...
2
by: Noozer | last post by:
Code sample: dim hash as Hashtable 'Declare Hashtable .... hash.add (picOne.image, "picture") 'Error here picOne is a picturebox added to the form at design time with a GIF image applied....
2
by: Andrew Morton | last post by:
I've opened a bitmap from a jpg file with Dim bmp As New Bitmap(IO.Path.Combine(origFolder, value)) ' now resize the image into another bitmap and save that where origFolder is the directory...
2
by: rksadhi | last post by:
/*Geting error ---object reference not set to an instance---at bold line----plz reply asap thanks in advance*/ cmd = new OleDbCommand ("SELECT e.emp_id,e.email, m.email AS Email FROM emp_details...
5
monirul arfin
by: monirul arfin | last post by:
Now I have another problem my pc is geting slow , But I am everyday perform disc defregment, disc checking, remove temp ( *.tmp, %temp% ) . And in my computer all drives have above 60% free space,...
2
by: Redligt World | last post by:
i have a adult based site i.m working on the works 100% ok in ie, but has major display errors in firefox You can view the site at http://www.redlightworld.com/premium Basically, the site views...
4
by: saunders1989 | last post by:
Hi, my goal is to create a website with an image gallery. i have about 6 buttons at the bottom of the page whcih when clicked will take you to a different album of photos. i have created the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.