ImageBundle icon indicating copy to clipboard operation
ImageBundle copied to clipboard

How get image width/height inside controller or entity ?

Open AxelBriche opened this issue 12 years ago • 3 comments

Hello, it's possible to get image height/width inside a controller or entity please ? Thanks.

AxelBriche avatar Feb 03 '14 00:02 AxelBriche

+1

EnchanterIO avatar May 17 '14 10:05 EnchanterIO

@TrkiSF2 you can with that:

        list($width, $height) = getimagesize($file); 
        $this->imageWidth = $width;
        $this->imageHeight = $height;

AxelBriche avatar May 17 '14 11:05 AxelBriche

What about:

<?php

$image = $this->get('image.handling')->open('image.jpg');
$width = $image->width();
$height = $image->height();

Gregwar avatar Jun 15 '14 16:06 Gregwar