Jump to content

Working with images in a Files field


Recommended Posts

I have a field that uses the Files fieldtype.  Images and videos are being uploaded to it.  Because it is not an Image fieldtype, I can't get an image width or height.  I believe there is a way with the Pageimages class, but I'm a bit rusty on how to do this.  There was a post on here that discussed how to do it but I can't find it.  Any help would be appreciated.

Link to comment
Share on other sites

Thanks.  To get the width and height of an image, I'm doing this:

// within repeater loop that has a file field called 'project_file'
$imageSizer = new ImageSizer($project_file->filename);
$width = $imageSizer->getWidth();
$height = $imageSizer->getHeight();

 

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...