JS get picture size and picture size width
This is a use of JS get picture size and picture size width Oh, the first example can get picture size, the second according to the size of the picture pops up a preview window of the same size.
<script language= Web page Special effects >
function Index_image_valid () {
Document.pho_up.indeximg.src=document.pho_up.pho_index.value;
Imagewidth=document.pho_up.indeximg.width;
Imageheigth=document.pho_up.indeximg.height;
alert ("Wide:" +imagewidth+ "N High:" +imageheigth);
}
</script>
</head>
<form name= "pho_up" method= "post" enctype= "Multipart/form-data" >
<input type= "File" Name= "Pho_index" size= "Class=input onchange=" Javascript:index_image_valid (); " >
<img name=indeximg>
</form>
Method Two
<HTML>
<head>
<title> Show picture dimensions </title>
<script language= "JavaScript"
<!--
Function preview (src)
{
NewWindow =window.open (', ' newwindow ', ' menubar=0,toolbar=0, Location=0,directories=0,status=0,scrollbars=0,resizable=1 ');
Newwindow.document.open ();
Newwindow.document.write (' <html><body bgcolor= ' #cccccc ' > ');
Newwindow.document.write (' <div align= "center" ><img src= "' +src+ '" Name= "img" ></div><br > ');
width = newwindow.document.images[' img '].width;
height = newwindow.document.images[' img '].height;
Newwindow.document.write (' File size; ' +width+ ' * ' +height);
if (width>100 && height>100)
Newwindow.resizeto (width+100, HEIGHT+100);
Else
Newwindow.resizeto (300,300);
}
//-->
</script>
</head>
<body>
<p align= "Center" > File location
<input type= "File" Name= "Newsimage" onchange= "Javascript:preview (this.value)" >
</p>
</body>
</html>
PHP Tutorials
?
$arr =getimagesize ("Images/album_01.gif");
echo $arr [3];
$strarr =explode ("" ", $arr [3]);
echo $strarr [1];
?>