登录 | 注册 | FAQ
Anonymous

image size of a php file

+ 发表回复

4 篇帖子 分页: 1 / 1


image size of a php file

shadmank » 周一 4月 14, 2014 5:49 pm

i made a php file to create small thumbnail of an image
and in another php file i.e in homepage i use that imagephpfile as src for image as its dimension are different for every image
i want dimension of that imagephpfile in home page i.e. through home page i want dimension of imagephp file
thanks in advance!!!!!!
头像

shadmank

  • 帖子: 21
  • 注册: 周一 12月 02, 2013 7:45 pm

Re: image size of a php file

XainPro » 周二 4月 15, 2014 7:41 am

if you do not set the deminsing in img tag then the image will be shown on it's actual demintions

<img src="imagefile.php" alt="image">

with no height and width attribute or you can set dimension by passing the height and width to phpfile like

<img src="imagefile.php?height=100&width=100" alt="image">

then in imagefile.php get it like

$_GET['height']
$_GET['width']

and build an image on that dimension
头像

XainPro

  • 帖子: 3933
  • 注册: 周五 2月 17, 2012 8:10 pm

Re: image size of a php file

shadmank » 周三 4月 16, 2014 8:03 pm

but my image size is not fixed so i want a way to find image size from home page instead of sending size to imagephpfile
头像

shadmank

  • 帖子: 21
  • 注册: 周一 12月 02, 2013 7:45 pm

Re: image size of a php file

XainPro » 周三 4月 16, 2014 10:26 pm

by using javasctipt you can do this

<img src="souce.php" id="imageid" >
<script>
var img = document.getElementById('imageid');
//or however you get a handle to the IMG
var width = img.clientWidth;
var height = img.clientHeight;

alert(width + ' '+ height);
</sctipt>
头像

XainPro

  • 帖子: 3933
  • 注册: 周五 2月 17, 2012 8:10 pm


+ 发表回复

分页: 1 / 1