Download link to image alias file

Author Message

Marco Zinn

Monday 16 November 2009 12:21:21 pm

Hi there...

I'm trying to create a download (!) link to an image file. To be precise, i want a download link to an image ALIAS file.

What I have is a link to the original file using this template code line:

<h2><a href="/content/download/{$node.data_map.image.contentobject_id}/{$node.data_map.image.id}">download</a> </h2>

I think, that URL code is not documented anywhere, but i just found it by tweaking file download URLs.

What i need is a download link to e.g. the "thumbnail" alias of the image attribute of the current node.

By "download link" i mean, that ez should sent HTTP header for DOWNLOADING the image, just like a file download. Currently, i only have a link, which SHOWS the image:

<a href={$node.data_map.image.content[thumbnail].full_path|ezroot}>

Well, let's hope, that this post actually gets posted...

Marco
http://www.hyperroad-design.com

Marco Zinn

Monday 16 November 2009 12:24:39 pm

Sorry about the "code" tags... it seems i cannot edit my own post and i was not aware of the "literal" tags in here.

[Edit]... damned, now it displays my edited post. Caching, i guess... as always...

Marco
http://www.hyperroad-design.com

Steven E. Bailey

Thursday 19 November 2009 2:39:11 am

Can this be done natively? I don't think so...

But, look at kernel/classes/binaryhandlers/ezfilepassthrough/ezfilepassthroughhandler.php and/or the eZFile::download function - that's how it would have to be done.

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

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 18 2025 00:51:29
Script start
Timing: Jan 18 2025 00:51:29
Module start 'layout'
Timing: Jan 18 2025 00:51:29
Module start 'content'
Timing: Jan 18 2025 00:51:30
Module end 'content'
Timing: Jan 18 2025 00:51:30
Script end

Main resources:

Total runtime1.0916 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 587.9375152.6250
Module start 'layout' 0.00650.0039 740.562539.4453
Module start 'content' 0.01041.0800 780.0078545.3047
Module end 'content' 1.09040.0012 1,325.312512.1563
Script end 1.0916  1,337.4688 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3081160.0002
Check MTime0.00130.1176160.0001
Mysql Total
Database connection0.00090.085310.0009
Mysqli_queries1.041295.3801570.0183
Looping result0.00060.0517550.0000
Template Total1.060497.120.5302
Template load0.00190.177220.0010
Template processing1.058496.958120.5292
Template load and register function0.00010.008910.0001
states
state_id_array0.00140.129610.0014
state_identifier_array0.00080.074920.0004
Override
Cache load0.00160.1487210.0001
Sytem overhead
Fetch class attribute can translate value0.00060.056820.0003
Fetch class attribute name0.00140.132650.0003
XML
Image XML parsing0.00100.088020.0005
class_abstraction
Instantiating content class attribute0.00000.001460.0000
General
dbfile0.00100.0872230.0000
String conversion0.00000.001340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs