Get file/image mime type from a fetched node

Author Message

Softriva .com

Sunday 25 February 2007 3:29:58 am

How to get the file/image mime type from a fetched node. I mean how do I know if the file is pdf or doc or jpg or gif

Claudia Kosny

Monday 26 February 2007 3:20:17 am

Hi OOzy

The content of the an attribute of type file is an ezbinaryfile object which has the property mime_type. See also here http://ez.no/doc/ez_publish/technical_manual/3_8/reference/objects/ezbinaryfile

Thus you should be able to fetch the mimetype like this (not tested...)
{$node.data_map.file_attribute.content.mime_type}

Claudia

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 04:33:13
Script start
Timing: Jan 31 2025 04:33:13
Module start 'layout'
Timing: Jan 31 2025 04:33:13
Module start 'content'
Timing: Jan 31 2025 04:33:13
Module end 'content'
Timing: Jan 31 2025 04:33:13
Script end

Main resources:

Total runtime0.0161 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 588.2656151.2266
Module start 'layout' 0.00470.0027 739.492236.6797
Module start 'content' 0.00740.0066 776.171990.0781
Module end 'content' 0.01400.0021 866.250029.9922
Script end 0.0161  896.2422 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002616.1479140.0002
Check MTime0.00138.0237140.0001
Mysql Total
Database connection0.00085.241810.0008
Mysqli_queries0.002515.262930.0008
Looping result0.00000.073910.0000
Template Total0.00159.410.0015
Template load0.00127.621810.0012
Template processing0.00031.771410.0003
Override
Cache load0.00095.639210.0009
General
dbfile0.001811.141080.0002
String conversion0.00000.051740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs