Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 New auto-resizing images version (1.2)
 New Topic  Topic Locked
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 5

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 27 September 2003 :  09:31:24  Show Profile
I've got an inconsistancy in IE6 also, in new window mode, the popup (showpic.asp) will resize to about 100x100 (smaller then the image), it usually only happens the first time you click the image, closing the window and clicking the same image again shows the popup as the correct size

The UK MkIVs Forum
Go to Top of Page

MadHatter
Starting Member

2 Posts

Posted - 27 September 2003 :  11:50:50  Show Profile
it wigs out when the new window opens up.
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 27 September 2003 :  13:03:58  Show Profile  Visit dayve's Homepage
quote:
Originally posted by DavidRhodes

I'll try it on mine, I have a DHTML menu so I think the onLoad events will conflict



any time you have multiple onLoad's in various scripts you can
remove the call from the actual script area and add it to the body
tag instead like this:

<body onLoad="script1();script2();script3();">


Edited by - dayve on 27 September 2003 13:04:18
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 27 September 2003 :  14:27:13  Show Profile
i've gone back to the modal window version due to problems with showpic.asp, the changes I made are below including adding a new function called popupPic (doesn't need to be a new function but i'm using it elsewhere). IE 5+ will show the image in a modal dialog window whilst other browser will popup in a normal window (not centred). Also added a title tag to the image (in red below).

function resizeImage(thisimage) {
    if (resizeType == 0) fixedWidth = parseInt(screen.width/dynamicDivisor);
    if (thisimage.width > fixedWidth) {
		thisimage.width = fixedWidth;
		thisimage.style.cursor='pointer';
		thisimage.title='Click to enlarge';
	}
}

function enlargeimg(which,e){
    if (resizeType == 0) fixedWidth = parseInt(screen.width/dynamicDivisor);
	if (which.width < fixedWidth) {return false;}
	if (enlargeType == 0) {
		if (ie||ns6){
			crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
			if (crossobj.style.visibility=="hidden"){
				crossobj.style.left = (ns6? pageXOffset : document.body.scrollLeft) + leftSpacing
				crossobj.style.top  = (ns6? pageYOffset : document.body.scrollTop) + topSpacing
			    alignRE = /^left$/i
				crossobj.innerHTML= (alignRE.test(alignClose))? '<div class=tvhead align=left id=drag> <span class=tvclosex onClick=closepreview() style=cursor:pointer> X </span> <span class=tvclose onClick=closepreview()>Close</span> </div><img src="'+which.src+'">' : '<div class=tvhead align=right id=drag> <span class=tvclose onClick=closepreview()>Close</span> <span class=tvclosex onClick=closepreview() style=cursor:pointer> X </span> </div><img src="'+which.src+'">';
				crossobj.style.visibility="visible"
			}
			else
				crossobj.style.visibility="hidden"
				return false
		}
		else if (document.layers){
			if (document.showimage.visibility=="hide"){
				document.showimage.document.write('<a href="#" onMouseover="drag_dropns(showimage)"><img src="'+which.src+'" border=0></a>')
				document.showimage.document.close()
				document.showimage.left=e.x
				document.showimage.top=e.y
				document.showimage.visibility="show"
			}
			else
				document.showimage.visibility="hide"
				return false
		}
		else
		return true
	}
	else if (enlargeType == 1) {
		popupPic(which.src);
	}
}

function popupPic(imagepath) {
	var tmpImg = new Image();
	tmpImg.src = imagepath;
	var width = tmpImg.width;
	var height = tmpImg.height;
	if (document.all&&window.print) //if ie5			
		eval('window.showModalDialog(tmpImg.src,"","help:0;resizable:0;scroll:0;dialogWidth:'+width+'px;dialogHeight:'+height+'px")')
	else
		eval('window.open(tmpImg.src,"","width='+width+'px,height='+height+'px,resizable=0,scrollbars=0,left=10,top=10")')
}

The UK MkIVs Forum

Edited by - DavidRhodes on 27 September 2003 14:30:07
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 27 September 2003 :  19:59:17  Show Profile  Visit dayve's Homepage
doesn't seem to work in Opera 7.20

Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 28 September 2003 :  18:44:09  Show Profile  Visit dayve's Homepage
I finally used the code provided here and like the popup window, but it doesn't work in Opera.
However, the modal window does work in Opera. To overcome this problem I used my browser sniffer
script that I have in inc_header.asp:


function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.opera6=this.agent.indexOf("Opera 6")>-1
	this.opera7=this.agent.indexOf("Opera 7")>-1
	this.opera = (this.opera5 || this.opera6 || this.opera7)
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.opera6 || this.opera7)
	return this
	
	}
var bw=new lib_bwcheck()


and then in the resizeimg.js I edited the parameters to look like:


if (bw.opera){
var enlargeType    = 0     // 0 = Opens in the same window
			   // 1 = Opens in a new window
} else {
var enlargeType    = 1
}


this seems to be working out very nicely this way.


Edited by - dayve on 28 September 2003 18:44:34
Go to Top of Page

skellyx
Starting Member

24 Posts

Posted - 30 September 2003 :  18:36:00  Show Profile
excused ugly English, you can help me.
when I put one image is not resize if I do not refresh at least once.
also in the new post it must refresh o re enter but to see the image resized.
Is possible fix the problem. thanks to all for the aid
Go to Top of Page

guessme
Banned User

393 Posts

Posted - 04 October 2003 :  00:06:49  Show Profile  Visit guessme's Homepage
Just added this. Someone posted a huge pic. When i first opened the post, the image was not resized. I closed out of the topic and reentered and then the image resized.

How come not the first time?

It is happening on all of them, the first time it's not resized.

Now i hear this from a member.

"My picture was made smaller at first, now it's big again."


Edited by - guessme on 05 October 2003 13:23:53
Go to Top of Page

work mule
Senior Member

USA
1358 Posts

Posted - 05 October 2003 :  22:10:20  Show Profile
Awesome job on fixing up that auto-resizing script.
This is a major improvement on the original!

quote:
Originally posted by DavidRhodes


thisimage.title='Click to enlarge';



What is that supposed to do?
I added it, looked and didn't see anything obvious.

quote:
Originally posted by Umlungu
The problem with the onload event handler for images is that browsers will cache the image and not "reload" it, thus not firing the event. Event handlers are really funny that way, especially with images.


(...using hard breaks to avoid horizontal scrolling.)

The reason I went with the onload event handler for images
is because at the time the document.onload event is fired,
the images may still be loading. If the image is still
loading at the time the images width and height properties
are checked, the dimensions will not be available. Which is
why I used onload event handlers on the images.

I had originally used a function similar to the walkimages()
function and I had cases where images weren't being resized.
I think this is what guessme is describing. The first time
the pictures are loaded, the images aren't resized. The
second time (now it's cached) it is resized.

I think a combination of both would work. Both methods
have faults which the other does better.

document.onload & walkimages() would work for cached images.

the onload event handler for the images would be effective
for large images or slow loading images still loading at
the time the document.onload is fired.

Here's what I'm going to add and see if there's any problems:

inc_func_common.asp

============================================================
ImgTags(1,2,2) = """ border=""0"" style='cursor:default' onload='resizeImage(this);' onClick='doimage(this,event)'>"

ImgTags(4,2,2) = """ id=""right"" border=""0"" style='cursor:default' onload='resizeImage(this);' onClick='doimage(this,event)'>"

ImgTags(6,2,2) = """ id=""left"" border=""0"" style='cursor:default' onload='resizeImage(this);' onClick='doimage(this,event)'>"
============================================================

Go to Top of Page

work mule
Senior Member

USA
1358 Posts

Posted - 05 October 2003 :  22:57:32  Show Profile
Something I wanted to do with this, but didn't have time
to figure out was to display another small image on top
of the images which where resized and could be clicked on
to view the full size image.

My thinking was that some people may not realize the image
had been automatically resized. The image would be a
"visual cue" to let people know.

The image would read simply "Click for larger" or similar.
I have images, but not the code to do this.

I'm thinking it's a matter of getting the coords and
doing a document write statement with another image tag
set to the same coords (upper left corner) and the z-index?
Go to Top of Page

work mule
Senior Member

USA
1358 Posts

Posted - 06 October 2003 :  02:58:56  Show Profile
quote:
Originally posted by guessme
<link removed sine image was removed>



Now that's just plain silly.

Edited by - davemaxwell on 06 October 2003 11:13:51
Go to Top of Page

serritzlev
Junior Member

Denmark
291 Posts

Posted - 06 October 2003 :  08:27:03  Show Profile  Visit serritzlev's Homepage
Now i have add your code to my test fora but that dont resize the wery large image 900x637 i have insert in topic. If i understand this rigth that schould ben resize to max400(300) but not works.

Link here http://www.assy.dk/forum/topic.asp?TOPIC_ID=114


Edited by - serritzlev on 06 October 2003 14:50:16
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 06 October 2003 :  16:03:24  Show Profile
guessme, please try to be more respectful of the members of this forum. your language, attitude and actions have been nothing short of offensive.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 22 October 2003 :  04:44:40  Show Profile
quote:
Originally posted by work mule

Awesome job on fixing up that auto-resizing script.
This is a major improvement on the original!

quote:
Originally posted by DavidRhodes


thisimage.title='Click to enlarge';



What is that supposed to do?
I added it, looked and didn't see anything obvious.



It adds a title attribute to a resized image so that when you hover over it, it says 'Click to enlarge'

The UK MkIVs Forum
Go to Top of Page

kwhipp
Junior Member

USA
407 Posts

Posted - 30 October 2003 :  21:57:42  Show Profile  Visit kwhipp's Homepage  Send kwhipp an AOL message  Send kwhipp an ICQ Message  Send kwhipp a Yahoo! Message
Excellent MOD!!!

- Kevin
Go to Top of Page
Page: of 5 Previous Topic Topic Next Topic  
Previous Page | Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000 Version 3.4.07