Author |
Topic |
|
redbrad0
Advanced Member
USA
3725 Posts |
Posted - 13 January 2001 : 11:03:39
|
When the snitz forum tells it to display a users picture, it sets the height and the width to 150 without knowing the users existing picture height and width. this can cause the picture to get stretched and not look right. there is a function that can be used to generate the height and width and not strech the picture.
response.write "<img src=""graphic.gif"" " & ImageResize(strImageName, 150, 150) & ">"
the first 150 is the width, and the second one is the height. this should fix the problem
Brad
this looks more like a Design Request With Code to me, Gor.. |
|
Aznknight
Senior Member
USA
1373 Posts |
Posted - 13 January 2001 : 17:11:39
|
Oh wow, what a useful function. Gotta try it out laters.
- Alan alan@calvsa.net www.calvsa.net
|
|
|
redbrad0
Advanced Member
USA
3725 Posts |
Posted - 13 January 2001 : 17:32:37
|
yea, let me know how it works. i have actually never used it, but it should work, well thats what i read
Brad |
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 13 January 2001 : 17:46:49
|
Where is this function coming from?
====== Doug G ====== |
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 13 January 2001 : 18:44:22
|
quote: Where is this function coming from?
Was wondering the same thing myself.
*----*----*----*----*----*----*----*----* "Even when you feel you have nothing left, You still have prayer--And that's enough." *----*----*----*----*----*----*----*----* |
|
|
Aznknight
Senior Member
USA
1373 Posts |
Posted - 13 January 2001 : 19:12:48
|
quote:
there is a function that can be used to generate the height and width and not strech the picture.
Hey brad,
I just tried it and there's no such ImageResize function. Where did you read about it?
In order to resize the picture dynamically I'm using ASPIMAGE server component that does this on server side.
- Alan alan@calvsa.net www.calvsa.net
|
|
|
redbrad0
Advanced Member
USA
3725 Posts |
Posted - 14 January 2001 : 02:42:06
|
i do not remember where i read it, im looking now to see where i read it. i will post the link as soon as i fidn it
Brad |
|
|
redbrad0
Advanced Member
USA
3725 Posts |
Posted - 14 January 2001 : 04:13:40
|
ok i finally found it
http://www.4guysfromrolla.com/webtech/011201-1.shtml
thats the article i read. i would think they would know what they are doing before the posted the article, but who knows. it sounds like he used this function on a job he did
Brad |
|
|
gor
Retired Admin
Netherlands
5511 Posts |
Posted - 14 January 2001 : 04:47:59
|
Brad,
If you had read the article a bit closer, you would have seen that you didn't tell the whole story. In the article they also give the code for the function ImageResize that is needed to get this to work.
function ImageResize(strImageName, intDesiredWidth, intDesiredHeight) dim TargetRatio dim CurrentRatio dim strResize dim w, h, c, strType
if gfxSpex(strImageName, w, h, c, strType) = true then TargetRatio = intDesiredWidth / intDesiredHeight CurrentRatio = w / h if CurrentRatio > TargetRatio then ' We'll scale height strResize = "width=""" & intDesiredWidth & """" else ' We'll scale width strResize = "height=""" & intDesiredHeight & """" end if else strResize = "" end if
ImageResize = strResize end Function
Pierre |
|
|
redbrad0
Advanced Member
USA
3725 Posts |
Posted - 14 January 2001 : 13:09:04
|
ops my brad i found it late at night one night and i guess i was a little more tired then i thought. thanks gor for helping me stay in line, well anyway that would help so the pic does not get all screwed up
Brad |
|
|
Aznknight
Senior Member
USA
1373 Posts |
Posted - 14 January 2001 : 14:57:32
|
quote:
Brad,
If you had read the article a bit closer, you would have seen that you didn't tell the whole story. In the article they also give the code for the function ImageResize that is needed to get this to work.
function ImageResize(strImageName, intDesiredWidth, intDesiredHeight) dim TargetRatio dim CurrentRatio dim strResize dim w, h, c, strType
if gfxSpex(strImageName, w, h, c, strType) = true then TargetRatio = intDesiredWidth / intDesiredHeight CurrentRatio = w / h if CurrentRatio > TargetRatio then ' We'll scale height strResize = "width=""" & intDesiredWidth & """" else ' We'll scale width strResize = "height=""" & intDesiredHeight & """" end if else strResize = "" end if
ImageResize = strResize end Function
Pierre
What about the gfxSpex function call? Doesn't look like a built in function to me. |
|
|
redbrad0
Advanced Member
USA
3725 Posts |
|
evehawk
New Member
Australia
65 Posts |
Posted - 17 January 2001 : 20:12:42
|
i use a simple way to fix this and i suppect it only work in IE but not with other browsers (i cant install netscape on my system to test this, the silly thing crash my puta grrr...). If you opmit the height = ".." tag inside the image tag and only specify the width tag then IE will auto-scale the image for you correctly. You can see the what i mean here: http://eve.121host.net/forum/topic.asp?TOPIC_ID=18&FORUM_ID=9&CAT_ID=5&Topic_Title=What a wonderful site%21&Forum_Title=Test Forum Isis's picture scaled correctly on topic post as well as in her profile if you look at it.
|
|
|
redbrad0
Advanced Member
USA
3725 Posts |
Posted - 18 January 2001 : 06:28:27
|
could someone please test this to see if this would be a problem in other browsers? maybe even a little javascript to check the users browser and if its ie then it removes the height, any ideas?
Brad |
|
|
MetaMorphic
Starting Member
4 Posts |
Posted - 27 February 2001 : 16:11:01
|
I am trying to get this code to work with my database. However, it keeps ignoring my resize.
<%response.write( "<img src=" & rsRecordSet("thumbnail") & ImageResize(strImageName, 100, 75) & ">")%></a>
|
|
|
|
Topic |
|