Hi Mark,
I’m using your file extension (which is a godsend by the way!) to upload PNG’s to the page, then am using jQuery png fix to render them correctly in IE6.
My problem is that in order for the jQuery png fix to work properly the embedded <img > must have a width and height attribute.
Is there a way within the FILE extension, to dynamically add width and height to the embedded image?
I already posted this question (but on the wrong part of the forum, I’m a forum beginner you see!) and was offered a solution that utilises PHP.
Does your extension pull in width and height anyway, without having to use extra PHP?
I have set up the extension like so:
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 hope this is enough information to go on. I look forward to your reply,
Thanks,
Jack - Cog Design
Around line 1225, find this;
$var = array(
'count' => $count+1,
'total_results' => $total_results,
'file_name' => $file,
'file_url' => $FNS->remove_double_slashes($file_field['url'].'/'.$file),
'file'.$this->thumb_suffix.'_name' => $thumb,
'file'.$this->thumb_suffix.'_url' => $thumb_url
);
change to this:
list($mh_file_width, $mh_file_height) = getimagesize($FNS->remove_double_slashes($file_field['url'].'/'.$file));
$var = array(
'count' => $count+1,
'total_results' => $total_results,
'file_name' => $file,
'file_url' => $FNS->remove_double_slashes($file_field['url'].'/'.$file),
'file'.$this->thumb_suffix.'_name' => $thumb,
'file'.$this->thumb_suffix.'_url' => $thumb_url,
'file_width' => $mh_file_width,
'file_height' => $mh_file_height
);
If you use the variable pairs, you can access the width with: file_width, and height with: file_height
is there a way to also add a filed to the file upload that you can use as a title?
Lets say you want to upload 5 pdf’s and you use the file upload allowing for multiple files. No trouble getting the files up, but what is you want to display a little text like a title for each one of those files, is there any way to do that?
is there a way to also add a filed to the file upload that you can use as a title? Lets say you want to upload 5 pdf’s and you use the file upload allowing for multiple files. No trouble getting the files up, but what is you want to display a little text like a title for each one of those files, is there any way to do that?
There’s an unofficial modification of the File extension that lets you do this. It adds title and caption fields directly beneath the file upload space. See http://ellislab.com/forums/viewthread/38997/P738/; boswebdev made it.
It’s a little bit buggy, I’ve found, but it might be exactly what you need.
I have a modified version of the file mentioned above, that’s NOT buggy. PM me and I’ll send it to you.
I also have a modded vs. of Huot’s file upload with some bugs fixed as well. I sent Mark Huot an email asking if I could release them, and as expected I didn’t hear back. I’m sure he’s very busy, and is probably sick of hearing about his stuff 😊 I don’t see any reason not to upload a fixed version of it though. If I had time, I’d rewrite it from the ground up so it’d be a new release with a new name so people wouldn’t get confused… but I think it’s kinda important to get the bug fixes out.
is there a way to also add a filed to the file upload that you can use as a title? Lets say you want to upload 5 pdf’s and you use the file upload allowing for multiple files. No trouble getting the files up, but what is you want to display a little text like a title for each one of those files, is there any way to do that?
I’m interested in the mods mentioned above but so far I’ve been using a heavily modified version of Mark Huot’s MultiText which seems to be obsolete courtesy LG Data Matrix (I think that was the name, am looking forward to using it on a future project). I would just store multitext fields in an array via php and when printing out each File image refer to the array with an index of {count} for the title, alt, and/or caption.
I just recently made a plugin that I realized you could inadvertently possibly store that stuff without using PHP on the template but I haven’t tested that out yet (it’s meant for search/replace templated code come to think of it it was specifically for capturing a div from file and putting it inside content).
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.