How i get width and height of a image in Laravel Framework?

ぐ巨炮叔叔 提交于 2020-01-24 02:14:27

问题


In this image,

I can get the width and height of the image in the directory.

But i want to get the width and height of a picture before i upload the image.

How can i achieve this?


回答1:


 $data = getimagesize($filename);
 $width = $data[0];
 $height = $data[1];



回答2:


Through Intervention Image you can do it as

$upload_file = $request->file('gallery_image');
$height = Image::make($upload_file)->height();
$width = Image::make($upload_file)->width();



回答3:


You can use

 <?php
$imagedetails = getimagesize($_FILES['file-vi']['tmp_name']);

$width = $imagedetails[0];
$height = $imagedetails[1];

?>


来源:https://stackoverflow.com/questions/45563291/how-i-get-width-and-height-of-a-image-in-laravel-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!