ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

CG FileInfo Plugin - Access File Manager Metadata and Image Sizes

September 13, 2011 12:38pm

Subscribe [2]
  • #1 / Sep 13, 2011 12:38pm

    My new ExpressionEngine plugin, CG FileInfo was released today on Devot://ee.

    Currently, there is no way to access all of the file metadata from within the Channel Entries loop, and it’s a highly requested feature:
    http://ellislab.com/forums/viewthread/188900

    CG FileInfo aims to solve this problem by giving you direct access to the native File Manager’s metadata and image manipulations within your templates.

    Here’s an example of how you would use it:

    {exp:channel:entries entry_id="1" dynamic="no"}
    
    <h4>Original File Field</h4>
    <p>{file}</p>
    
    <p>{exp:cg_fileinfo file="{file}"}<br />
        <br />
        </p><h4>Mimetype</h4>
    <p>    {mime_type}</p>
    
    <p>    </p><h4>Thumbnail</h4>
    <p>    {thumbnail}</p>
    
    <p>    </p><h4>Caption</h4>
    <p>    {caption}</p>
    
    <p>    </p><h4>Size (human-readable size)</h4>
    <p>    {size} ({human_size})</p>
    
    <p>    </p><h4>Upload Date</h4>
    <p>    {upload_date format="%M %d %Y"}</p>
    
    <p>    </p><h4>Height and Width</h4>
    <p>    {height} x {width}</p>
    
    <p>    </p><h4>Is it an image?</h4>
    <p>    {if is_image}<br />
            I say yes.<br />
        {if:else}<br />
            I say no.<br />
        {/if}</p>
    
    <p>{/exp:cg_fileinfo}<br />
    {/exp:channel:entries}

    Check it out on Devot://ee.

    Also, full documentation is provided.

  • #2 / Aug 09, 2012 3:05am

    Kubik101

    155 posts

    I can not get this to work.
    I am using EE 2.5.2 with the Structure Module.

    {exp:channel:entries channel="tech_bulletins" dynamic="no" orderby="order_documents" sort="asc"}
                        <!-- item -->
                        {exp:cg_fileinfo file="{file}"}
                        <a href="http://{file}" target="_blank" rel="noopener"><b>{title}</b>__                    <span>Modified: {modified_date format="%d %M %Y"} <span>|</span> File Size: Human = {human_size} | Size = {size}</span></a>
                        {/exp:cg_fileinfo}
                        {/exp:channel:entries}

    I get an error:

    Error
    
    The following tag has a syntax error:
    
    {exp:cg_fileinfo}
    
    Please correct the syntax in your template.
  • #3 / Aug 09, 2012 6:43pm

    Before I dig in to help you out here, I’d suggest using the native EE file field, since the features of CG File Info have now been incorporated into the core. You might check out the documentation here:

    http://ellislab.com/expressionengine/user-guide/modules/channel/custom_fields.html#file-field

  • #4 / Aug 09, 2012 9:13pm

    Kubik101

    155 posts

    Thanks for the info.
    Couldn’t get it to work.

    This is what I tried:

    {exp:channel:entries channel="tech_bulletins" dynamic="no" orderby="order_documents" sort="asc"}
                        <!-- item -->
                        <a href="http://{file}" target="_blank" rel="noopener"><b>{title}</b>__                    {file}<span>Modified: {modified_date format="%d %m %Y"} <span>|</span> File Size: {file_size}</span>{/file}</a>
                        {/exp:channel:entries}
  • #5 / Aug 09, 2012 9:17pm

    As I don’t work for EllisLab, and this is a feature of the EE core, I would suggest you request support from the official support forums for this issue.

  • #6 / Aug 09, 2012 9:26pm

    Kubik101

    155 posts

    Have done, thank you.

    For those following: http://ellislab.com/forums/viewthread/222364/

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases