Use PHP or JS to obtain the image size and height and width. $Arrgetimagesize(imagesalbum_01.gif); echo $ arr [3]; $ strarrexplode (, $ arr [3]); echo $ strarr [1];? ScriptfunctionWa_SetImgAutoSize (img) {varimgdocument. all. img1; get the image $ arr = getimagesize ("images/album_01.gif ");
Echo $ arr [3];
$ Strarr = explode ("", $ arr [3]);
Echo $ strarr [1];
?>
Script
Function Wa_SetImgAutoSize (img)
{
// Var img = document. all. img1; // Obtain the image
Var MaxWidth = 200; // sets the image width limit.
Var MaxHeight = 100; // sets the image height limit.
Var HeightWidth = img. offsetHeight/img. offsetWidth; // you can specify the aspect ratio.
Var WidthHeight = img. offsetWidth/img. offsetHeight; // Set the aspect ratio.
Alert ("test" img. offsetHeight img. fileSize );
If (img. offsetHeight> 1) alert (img. offsetHeight );
If (img. readyState! = "Complete "){
Return false; // make sure the image is fully loaded.
}
If (img. offsetWidth> MaxWidth ){
Img. width = MaxWidth;
Img. height = MaxWidth * HeightWidth;
}
If (img. offsetHeight> MaxHeight ){
Img. height = MaxHeight;
Img. width = MaxHeight * WidthHeight;
}
}
Function CheckImg (img)
{
Var message = "";
Var MaxWidth = 1; // sets the image width limit.
Var MaxHeight = 1; // sets the image height limit.
If (img. readyState! = "Complete "){
Return false; // make sure the image is fully loaded.
}
If (img. offsetHeight> MaxHeight) message = "r height excess:" img. offsetHeight;
If (img. offsetWidth> MaxWidth) message = "r width exceeded:" img. offsetWidth;
If (message! = "") Alert (message );
}
Script
Outputs (images/album_01.gif); echo $ arr [3]; $ strarr = explode (, $ arr [3]); echo $ strarr [1];? Script function Wa_SetImgAutoSize (img) {// var img = document. all. img1; // Obtain the image...