How to display the height and the width of the original image next to it's thumbnail
PermalinkI can display thumbs of several images in a list. I can also display custom attributes (such as description, filetype and size) next to them. But I cannot display the default(!) attributes height and width of the original images in the file manager. It is nessesary to let the guest know the dimensions of the original file
This (for example)
<li> <div style="float: left; width: 150px; "> <?php $im->outputThumbnail($f, 150, 250);?> </div> <div style="float: right; width: 300px; "> <?php echo $tip_text;?> <br> <?php echo $f->getSize();?> <br> <?php echo $f->getwidth();?> <br> <br> <br> <a href="<?php echo $fv->getURL();?>">download</a></div> <div class="clear"></div>
returns
Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'FileVersion' does not have a method 'getwidth' in /home/urispcen/c5/concrete/core/models/file.php on line 35
So far so good, but what is the function to display width and height.
I am looking forward for your help people...
Best Mathias
It works perfect. Thank You! And it is soooo simple...
My last try was ...
... but it only works when I write the complete path into the code (XXX). I doesn't work with "getPath" or "getURL".
So I gave up...
Thank You!
Mathias
$src = $f->getRelativePath();
http://www.concrete5.org/community/forums/customizing_c5/image-file...
Thank You.
Sorry. I also tried that. But it also doesn't work.
At all three options C5 displays (echo) the right path in the browser. When I copy the path from the browser and put it into the code, it works fine. But when I insert "$src = $f->getPath();" or one of the other options into the code, C5 displays the alert (see above). Maybe it is a bug.
Best
Mathias
I forgot to tell you, that the problem-code was part of a template for the Add On "List Files from Set". Maybe that causes path problems.
Nevertheless the problem is solved for me now.
But I will try to rebuild that code tonight.
Best Mathias
$dimensions = $f->getAttribute('width')." x ".$f->getAttribute('height');
and added this line just below the thumbnail output:
<div><?php echo $dimensions ;?></div>
Works great.
you should get the file's original width and height.
Hope that helps!