Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

netscape - uploaded image width and height ?

Status
Not open for further replies.

iza

Programmer
Apr 4, 2000
1,804
FR
hi :)
i haven't found this question answered, and i'm wondering if this is possible
i have an <input type=file .....> to upload an image. Before sending it to the server, there is a feature to display it (ok it's window.open ..... with the image as a parameter). I wish the window to have the width and height of the image - how could i capture it in nn ??
thanx for any idea :))
 
feel like i haven't seen you for ages!!! :)

hang on a second, i'll see what we can do with it (if someone else /quicker than me/ won't answer you here) Victor
 
i wasn't here for ages !!! hopefully, as soon as this problem is solved i MIGHT have some time to come back ;))

just in case, here is the code (so far)
<INPUT TYPE=FILE name=image_filename>
<INPUT TYPE=BUTTON VALUE=&quot;View&quot; onClick=
&quot;if (image_filename.value != '') {
var url ='resources/view_image.php?image_filename=file:'+image_filename.value;
var width=image_filename.width + 10;
var height = image_filename.height + 10;

window.open(url, '', 'width='+width+',height='+10+', resizable=yes');} else alert('no image to view !');&quot;>


width and height are NaN ... tried image_filename.value.height and image_filename.src.height (just in case ;))) and still NaN ... according to devedge, it seems the image has first to be downloaded (then it sure can't work !)
 
>according to devedge, it seems the image has first to be downloaded (then it sure can't work !)

why it sure can't work?
why won't you resize that window onload with image sizes ? Victor
 
because the image hasn't been sent to the server yet ... so i can't preload it (it's not downloaded yet ...). It's a preview before the form is sent ...
but ... you're right !!! the opening window is the result of a get, as i pass the variable like this : ?image_filename=... - i'll try to resize the window on open, you're right !!!
coding this right now ...
 
geee :) i'm proud of myself :)

because the image hasn't been sent to the server yet ... so i can't preload it (it's not downloaded yet ...). It's a preview before the form is sent ...
i knew that :) my first question was just prelude to the next one :) Victor
 
i love it when you make my brain work ;]]]
oook it's working like a dream !!!!
here is the code for those interested, but i used mostly php code - but it sure can be easily adapted in javascript
<?php

$size = GetImageSize ($actual_image_name);
$height = $size[1] + 30;
$width = $size[0] + 10;
?>
<body onload=&quot;javascript:window.innerHeight=<?php echo $height ?>; window.innerWidth=<?php echo $width ?>&quot;>
 
what about other browsers but your lovely netscrap? :))))

ps: i like php, looks nice; may be i'll start studying it.. Victor
 
well, other browsers aren't such a pain to develop for ;))
the interface already looks ugly in netscrap, so i might as well add some niiiiice features (so that people don't think of the ugly look) ;)
 
i meant window.innerHeight (just in case) Victor
 
yeah, i saw that
buuuuut .... just to annoy lucky ie users, they won't benefit from this feature ! >>:]
ok maybe i'll fix that (but guess what ? msdn html tag + javascript + css reference can't be read with nn, neither opera !!! and i don't feel like re booting under windows to use ie, so i'll wait to fix this - and also, i found new wonderful bugs to fix (such as : my uploaded image were all named the same => the browser always displays what's in the cache, not the actual image .... call me stupid, i haven't even thought of this !!! and i have to present my work in 2 hours from now ... hot hot hot !!!))
 
i'm shure you're doing the same, but just in case:
add something to that image name (time to miliseconds, for example)

>>msdn html tag + javascript + css reference
whats that? 8| Victor
 
well the time you posted the answer i already had added a random number to the image name
also added a function to check its type
also added another one to resize it slighlty ...

fffffftttt !!

... and i'm not done yet !!

>>msdn html tag + javascript + css reference
i meant, the microsoft's references for these - msdn is something like microsoft developper library - but it's designed only for ie :((
well i'll stick to the w3c one and forget about ie specifics !!
 
>>well the time you posted the answer i already had added a random number to the image name
that wasn't fair!! i've been busy here!! (this @#$% scanner!!) :))

>>also added a function to check its type
also added another one to resize it slighlty ...

wow, you've been busy!! :)

Victor
 
and i'm still busy .... as soon as i have 5 minutes i'll go & look for ie window width & height !!
 
ie:
document.body.clientWidth
document.body.clientHeight

are you talking about these?? Victor
 
actually, yes !!!! i'll try them as soon as i have fixed some weird bugs (fighting between java and php session id, about to win !)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top