Dexterity - TAL Expression to Display Images from Blobstorage

Andreas Mantke <[email protected]>
Newsgroups gmane.comp.web.zope.plone.user
Message-ID <[email protected]>
Hello,

I'm working on a Plone add-on for a project site where contributors
could upload their extensions and templates. The product contains three
content types:
- eupcenter
- eupproject
- euprelease.

I created the add-on using Dexterity content types (grok style) with
view-templates for each content type. The views are made with TAL
expressions.

I created a catalog query with a form and a list of direct catalog query
for each category.

There is also a results area that currently works with the category queries.

The category queries are coded in TAL expression like this (in the
eupcenter-view):



           <div class="" id="bycategory">

            <h2 tal:condition="here/product_title" i18n:translate="">
                Browse <span tal:content="context/product_title"
i18n:name="product_title" /> by Category
            </h2>
            <h2 tal:condition="not:context/product_title"
i18n:translate="">Browse Extensions by Category</h2>

            <ol id="add-on-categories">
                <tal:categories repeat="category
context/available_category">

                <li><a href=""
                            tal:attributes="href
string:${context/absolute_url}?getCategories=${category}&getCompatibility=any"
                            tal:content="category"
                            ><tal:comment replace="nothing">Extension
releases</tal:comment></a></li>
                </tal:categories>
            </ol>

        </div>


The results  area is currently coded in the template like this (in the
eupcenter-view):

              <div class="" id="categories"
                            tal:define="results
python:view.get_products(currentCategory, currentVersion, sort_on,
SearchableText);
                                        Batch
python:modules['Products.CMFPlone'].Batch;
                                        b_size python:10;b_start
python:0;b_start request/b_start | b_start;
                                        desc_length
site_properties/search_results_description_length;
                                        desc_ellipsis
site_properties/ellipsis;">

                        (...)
                        <tal:results
                                     define="batch python:Batch(results,
b_size, int(b_start), orphan=1);">
                            <ul class="downloads">
                                <li tal:repeat="result batch">
                                    <tal:entry
                                            define="project
result/getObject;
                                                    url result/getURL;
                                                    projectURL
project/absolute_url;
                                                    result_type
result/portal_type;
                                                    zoomid  
python:project.id.replace('.', '_');
                                                    screenshot  
project/getScreenshot | nothing">
                                        <h3 style="border-top: none">
                            <a href=""
                                tal:attributes="href projectURL;"
                                tal:content="result/pretty_title_or_id">
                            </a>
                        </h3>
                            <span class="project-thumb">

                            <img
tal:condition="project/project_logo|nothing"
                                tal:replace="structure
project/project_logo" />

                            <img
tal:condition="project/project_logo|nothing" tal:attributes="src
string:${project/absolute_url}/@@download/project/project_logo          
/${project/project_logo/filename};
                         height picture/_height | nothing;
                         width picture/_width | nothing;"
            />
</span>
(...)

------------- end of TAL snipped --------------

I want to get the image from the field "project_logo = NamedBlobImage"
(from eupproject.py) with the TAL expression. But the image could not be
loaded because the expression was not replaced with the URL to the
project or the file.

I could show the image with a similar TAL expression on the
eupproject-view. But it is currently not possible to scale the image
down. Would be nice to get a hint, how to fix that, too.

The source code of the add-on is hosted at:
https://github.com/tdf/tdf.extensionsuploadcenter

Thanks for any help in advance
Andreas

-- 
## Developer LibreOffice
## Freie Office-Suite für Linux, Mac, Windows
## http://LibreOffice.org
## Support the Document Foundation (http://documentfoundation.org)
## Meine Seite: http://www.amantke.de 


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Plone-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plone-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.