/    Sign up×
Community /Pin to ProfileBookmark

how do I change the images size in this script for landscape or portrait

I have one problem with my site that I can’t fix. I know noting about javascript. This is a plug-in and I need to make what I hope is a small change but looking at responses to similar questions in this forum I can’t figure it out. The script opens an image in the same page when the corresponding thumbnail is clicked. I have set the image to open to 65% so that it is relative to the browser window size but what I would like to add is something like

if image width = 640 px then width is 75%
else if height = 480 px then height is 65%

I am using it at
[URL=http://kgrantphoto.com/page/domr.php]this site[/URL]

This is the code I am using so thanks if anyone can offer some help.
had a small script in php that resized images too a thumbnail. I also have a javascript image viewer on the page.

I read a directory with images and load the image names into a list (form). When you select an image and press a show button the image is shown on the page.

if (preloadimg==”yes”){
for (x=0; x<dynimages.length; x++){
var myimage=new Image()
myimage.src=dynimages[x][0]
}
}

function returnimgcode(theimg){
var imghtml=””
if (theimg[1]!=””)
imghtml='<a href=”‘+theimg[1]+'” target=”‘+optlinktarget+'”>’
imghtml+='<img src=”‘+theimg[0]+'” border=”‘+imgborderwidth+'” width=”65%”>’
if (theimg[1]!=””)
imghtml+='</a>’
return imghtml
}

function modifyimage(loadarea, imgindex){
if (document.getElementById){
var imgobj=document.getElementById(loadarea)
if (imgobj.filters && window.createPopup){
imgobj.style.filter=filterstring
imgobj.filters[0].Apply()
}
imgobj.innerHTML=returnimgcode(dynimages[imgindex])
if (imgobj.filters && window.createPopup)
imgobj.filters[0].Play()
return false
}}

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @last_ditch spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...