By ecksley on
Hello,
Does the image field record an uploaded image's width or height? I noticed that I am able to restrict image size when I configure a field. So I was hoping it would make note of the width and height, which I happen to need for my site.
However, when I look at the field's array I don't see it:
[field_portfolio_image] => Array
(
[0] => Array
(
[fid] => 30
[list] => 1
[data] => Array
(
[description] =>
[alt] =>
[title] =>
)
[uid] => 1
[filename] => psaw_idMaster.jpg
[filepath] => sites/all/files/portfolioImages/psaw_idMaster.jpg
[filemime] => image/jpeg
[filesize] => 37903
[status] => 1
[timestamp] => 1238743283
)
)
If it is not recorded in the array by default, do you know of any way to possibly add it? One less elegant work around I thought of was to manually include the values in the file name and just parse it. But I figured it would be smart to ask in case something already exists in the CMS.
Thank you so much for reading. I appreciate any insight you might have!
Comments
u may call the drupal
u may call the drupal function :
$result = image_get_info($file)
buy me a beer, then check the $result['width'] and $result['height'] ...
enjoy..
Thank you kindly for the
Thank you kindly for the answer.
I'm actually trying to pull the values into a Flash piece using AMF PHP/Services. That said I'll need to look into using your trick to change the field array output.
Maybe some sort of reprocess function adding a key for height and width? But that's another problem for another day.
Thank you again!
looks u want to know the
looks u want to know the image width and height to build your bmp buffer in your flash ..
any way..good luck ..
That's exactly right. If I
That's exactly right. If I have success I will be sure to post it here.
Thanks so much for your help!
Thanks too a tip from Nate
Thanks to a tip from Nate Haug I have found an easy solution to this problem. Figured I'd post it here for those like me that didn't know:
Simply enabling the filefield_meta.module, which comes with filefield will provide the height and width data for every image loaded thereafter in the $node->field_image[0] array.