Hi Mark,
I work for a company called Cog Design, and we are using your extension on a site we are building. So far, it has been very helpful (much easier to use then EE’s standard file upload).
However, I need a way to generate the width and height attribute for the uploaded image, once it is fed through to the page.
Within the file upload preferences, I have set it not to resize images, or generate a thumbnail.
Within the page, I have put the following code:
{exp:weblog:entries weblog="{my_weblog}" disable="member_data|categories|pagination|trackbacks" status="open" limit="1"}
<h1>{title}</h1>
{generic_body}
{if generic_image!=''}
{generic_image}
{file_url}
{/generic_image}
{/if}
{/exp:weblog:entries}
I just need a way of dynamically inserting the width and height attributes for the image. Hope you can help!
Thanks,
Jack, Cog Design
Hi Jack,
By extension I am guessing that you are referring to the File extension by Mark Huot perhaps? If so then that is a 3rd party extension which wasn’t developed by EllisLab.
Saying that however I don’t think that the extension has any variables for height and width in it so you are probably going to need to use some PHP to take the path of the image and then spit out the values for you in that way.
I have some sample code to take an image path and get the sizes for you shown below if you want to use that.
<?php
$imageurl ="http://www.example.com/images/photos/{image-url}";
list($width, $height, $type, $attr) = getimagesize("$imageurl");
?>
You can then output the details like this further in your template :
<?php
echo $width;
echo $height;
?>
Hope that helps a bit.
Best wishes,
Mark
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.