how to display image field in pt file

4 messages Options
Embed this post
Permalink
Adam Tang-2 () how to display image field in pt file
Reply Threaded More More options
Print post
Permalink
Hi all,

I had defined a content type shema that contained 4 image field , I want to display these image in pt . But I had not idea to fetch them in PT file.


This is interface :

class Igoods(Interface):
    """A goods for online sale"""

    # -*- schema definition goes here -*-
    details = schema.Text(
        title=_(u"Details"),
        required=True,
        description=_(u"Field description"),
    )

    photo4 = schema.Bytes(
        title=_(u"Photo 4"),
        required=False,
        description=_(u"photo of goods"),
    )

This is schema define:

goodsSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-

    atapi.TextField(
        'details',
        storage=atapi.AnnotationStorage(),
        widget=atapi.TextAreaWidget(
            label=_(u"Details"),
            description=_(u"Field description"),
        ),
        required=True,
    ),

    atapi.ImageField(
        'photo1',
        storage=st,
        max_size = zconf.ATImage.max_image_dimension,
        sizes= {'large'   : (768, 768),
                'preview' : (200, 200),
                 'thumb'   : (128, 128),
                 'tile'    :  (64, 64),
                      },
        widget=atapi.ImageWidget(
            label=_(u"Photo 4"),
            description=_(u"photo of goods"),
        ),
        validators = (('isNonEmptyFile', V_REQUIRED),
                             ('checkImageMaxSize', V_REQUIRED)),
    ),


Any suggestions will be welcome!

- Adam
--
三人行必有我师!
There are three men walking together.(Triplicity means collaboration,innovation,comity THREE AS ONE.)
WebSite building Expert:http://315ok.org/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
ajung () Re: how to display image field in pt file
Reply Threaded More More options
Print post
Permalink
Archetypes image fields provide a tag() method for rendering the actual  tag.
Please google a bit..or grep through existing source code using image fields.

-aj

Adam Tang-2 wrote:
Hi all,

I had defined a content type shema that contained 4 image field , I want to
display these image in pt . But I had not idea to fetch them in PT file.


This is interface :

class Igoods(Interface):
    """A goods for online sale"""

    # -*- schema definition goes here -*-
    details = schema.Text(
        title=_(u"Details"),
        required=True,
        description=_(u"Field description"),
    )

    photo4 = schema.Bytes(
        title=_(u"Photo 4"),
        required=False,
        description=_(u"photo of goods"),
    )

This is schema define:

goodsSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-

    atapi.TextField(
        'details',
        storage=atapi.AnnotationStorage(),
        widget=atapi.TextAreaWidget(
            label=_(u"Details"),
            description=_(u"Field description"),
        ),
        required=True,
    ),

    atapi.ImageField(
        'photo1',
        storage=st,
        max_size = zconf.ATImage.max_image_dimension,
        sizes= {'large'   : (768, 768),
                'preview' : (200, 200),
                 'thumb'   : (128, 128),
                 'tile'    :  (64, 64),
                      },
        widget=atapi.ImageWidget(
            label=_(u"Photo 4"),
            description=_(u"photo of goods"),
        ),
        validators = (('isNonEmptyFile', V_REQUIRED),
                             ('checkImageMaxSize', V_REQUIRED)),
    ),


Any suggestions will be welcome!

- Adam
--
三人行必有我师!
There are three men walking together.(Triplicity means
collaboration,innovation,comity THREE AS ONE.)
WebSite building Expert:http://315ok.org/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Plone-Users mailing list
Plone-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plone-users
Adam Tang-2 () Re: how to display image field in pt file
Reply Threaded More More options
Print post
Permalink
Thanks a lot for your answer.

I found the "image_view_large" pt file that contained a render image code using imagefield tag function. See the following:
 <a href=""
       tal:attributes="href context/portal_url"
       tal:condition="not: request/HTTP_REFERER"
       >
       <span i18n:translate="label_home">Home</span><br />
       <tal:block replace="structure python: context.tag(scale='large')" />
    </a>

My question is the 'context' should be a content type that contained image schema,if my content type contained multi imagefiled ,how to render them one by one in pt file?

Thanks .

--Adam

2009/10/28 ajung <[hidden email]>

Archetypes image fields provide a tag() method for rendering the actual
tag.
Please google a bit..or grep through existing source code using image
fields.

-aj


Adam Tang-2 wrote:
>
> Hi all,
>
> I had defined a content type shema that contained 4 image field , I want
> to
> display these image in pt . But I had not idea to fetch them in PT file.
>
>
> This is interface :
>
> class Igoods(Interface):
>     """A goods for online sale"""
>
>     # -*- schema definition goes here -*-
>     details = schema.Text(
>         title=_(u"Details"),
>         required=True,
>         description=_(u"Field description"),
>     )
>
>     photo4 = schema.Bytes(
>         title=_(u"Photo 4"),
>         required=False,
>         description=_(u"photo of goods"),
>     )
>
> This is schema define:
>
> goodsSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((
>
>     # -*- Your Archetypes field definitions here ... -*-
>
>     atapi.TextField(
>         'details',
>         storage=atapi.AnnotationStorage(),
>         widget=atapi.TextAreaWidget(
>             label=_(u"Details"),
>             description=_(u"Field description"),
>         ),
>         required=True,
>     ),
>
>     atapi.ImageField(
>         'photo1',
>         storage=st,
>         max_size = zconf.ATImage.max_image_dimension,
>         sizes= {'large'   : (768, 768),
>                 'preview' : (200, 200),
>                  'thumb'   : (128, 128),
>                  'tile'    :  (64, 64),
>                       },
>         widget=atapi.ImageWidget(
>             label=_(u"Photo 4"),
>             description=_(u"photo of goods"),
>         ),
>         validators = (('isNonEmptyFile', V_REQUIRED),
>                              ('checkImageMaxSize', V_REQUIRED)),
>     ),
>
>
> Any suggestions will be welcome!
>
> - Adam
> --
> 三人行必有我师!
> There are three men walking together.(Triplicity means
> collaboration,innovation,comity THREE AS ONE.)
> WebSite building Expert:http://315ok.org/
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Plone-Users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-users
>
>

--
View this message in context: http://n2.nabble.com/how-to-display-image-field-in-pt-file-tp3903876p3904558.html
Sent from the General Questions mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users



--
三人行必有我师!
There are three men walking together.(Triplicity means collaboration,innovation,comity THREE AS ONE.)
WebSite building Expert:http://315ok.org/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Adam Tang-2 () Re: how to display image field in pt file
Reply Threaded More More options
Print post
Permalink
I found these image fieldes's size property do not work  in my self-define content type. So these links :http://mysite/self-object/photo1_mini or http://mysite/self-object/photo1_large would not work,but http://mysite/self-object/photo1 work.




2009/10/29 Espen Moe-Nilssen <[hidden email]>
I know very little about this, but you could check the PlonaArticle product that does this.

Espen

Den 29. okt. 2009 kl. 03.23 skrev adam tang:

Thanks a lot for your answer.

I found the "image_view_large" pt file that contained a render image code using imagefield tag function. See the following:
 <a href=""
       tal:attributes="href context/portal_url"
       tal:condition="not: request/HTTP_REFERER"
       >
       <span i18n:translate="label_home">Home</span><br />
       <tal:block replace="structure python: context.tag(scale='large')" />
    </a>

My question is the 'context' should be a content type that contained image schema,if my content type contained multi imagefiled ,how to render them one by one in pt file?

Thanks .

--Adam

2009/10/28 ajung <[hidden email]>

Archetypes image fields provide a tag() method for rendering the actual
tag.
Please google a bit..or grep through existing source code using image
fields.

-aj


Adam Tang-2 wrote:
>
> Hi all,
>
> I had defined a content type shema that contained 4 image field , I want
> to
> display these image in pt . But I had not idea to fetch them in PT file.
>
>
> This is interface :
>
> class Igoods(Interface):
>     """A goods for online sale"""
>
>     # -*- schema definition goes here -*-
>     details = schema.Text(
>         title=_(u"Details"),
>         required=True,
>         description=_(u"Field description"),
>     )
>
>     photo4 = schema.Bytes(
>         title=_(u"Photo 4"),
>         required=False,
>         description=_(u"photo of goods"),
>     )
>
> This is schema define:
>
> goodsSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((
>
>     # -*- Your Archetypes field definitions here ... -*-
>
>     atapi.TextField(
>         'details',
>         storage=atapi.AnnotationStorage(),
>         widget=atapi.TextAreaWidget(
>             label=_(u"Details"),
>             description=_(u"Field description"),
>         ),
>         required=True,
>     ),
>
>     atapi.ImageField(
>         'photo1',
>         storage=st,
>         max_size = zconf.ATImage.max_image_dimension,
>         sizes= {'large'   : (768, 768),
>                 'preview' : (200, 200),
>                  'thumb'   : (128, 128),
>                  'tile'    :  (64, 64),
>                       },
>         widget=atapi.ImageWidget(
>             label=_(u"Photo 4"),
>             description=_(u"photo of goods"),
>         ),
>         validators = (('isNonEmptyFile', V_REQUIRED),
>                              ('checkImageMaxSize', V_REQUIRED)),
>     ),
>
>
> Any suggestions will be welcome!
>
> - Adam
> --
> 三人行必有我师!
> There are three men walking together.(Triplicity means
> collaboration,innovation,comity THREE AS ONE.)
> WebSite building Expert:http://315ok.org/
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Plone-Users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-users
>
>

--
View this message in context: http://n2.nabble.com/how-to-display-image-field-in-pt-file-tp3903876p3904558.html
Sent from the General Questions mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users



--
三人行必有我师!
There are three men walking together.(Triplicity means collaboration,innovation,comity THREE AS ONE.)
WebSite building Expert:http://315ok.org/
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
Plone-Users mailing list




--
三人行必有我师!
There are three men walking together.(Triplicity means collaboration,innovation,comity THREE AS ONE.)
WebSite building Expert:http://315ok.org/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users