digideskio / zotonic

Automatically exported from code.google.com/p/zotonic
0 stars 0 forks source link

image_url tag not working on linked media #175

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a predicate, Background. From: Text, To: Image
2. Go to Media, upload an image
3. Go to a text entry, create a page connection "Background" from the text to 
the newly uploaded image
4. In a template:

    {% if m.rsc[id].background %}
        {% with m.rsc[id].background as mid %} 
            {% with m.rsc[mid].medium.filename as fln %} 
                {% print fln %}
                {% image_url fln %}
            {% endwith %}
        {% endwith %}
    {% endif %}

If you navigate to the text with background, the following error is output:

{error,
    {error,function_clause,
        [{filename,join1,
             [[<<"2011/5/11/management.png">>,37,50,56,37,50,57,37,50,56,69,
               50,57,70,65,53,48,66,52,57,56,54,51,67,54,48,56,53,66,53,54,69,
               65,56,49,56,65,69,67,57,70,49,37,50,57,46,106,112,103],
              [],"/egami/",unix]},
         {z_media_tag,url1,3},
         {z_media_tag,url,3},
         {template_rusukr__home_dmitriid_dmitriid_com_erl_sites_bin____priv_sites_rusukr_templates_page_tpl,
             render2,2},
         {template_rusukr__home_dmitriid_dmitriid_com_erl_sites_bin____priv_sites_rusukr_templates_page_tpl,
             render,2},
         {z_template,render1,4},
         {resource_page,html,1},
         {resource_page,to_html,2}]}}

The {% image %} tag works as expected though

Original issue reported on code.google.com by dmitr...@gmail.com on 11 May 2011 at 9:39

GoogleCodeExporter commented 8 years ago
Possible solution:

z_media_tag:url1/3

Now it reads:

url1(Filename, Options, Context) ->
    {TagOpts, ImageOpts} = lists:partition(fun is_tagopt/1, Options),

Change it to:

url1(File, Options, Context) ->
    Filename = z_convert:to_list(File),
    {TagOpts, ImageOpts} = lists:partition(fun is_tagopt/1, Options),

Original comment by dmitr...@gmail.com on 11 May 2011 at 9:50

GoogleCodeExporter commented 8 years ago
This issue was closed by revision e823be106b6c.

Original comment by scherpenisse on 30 Jun 2011 at 8:10