问题
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