AW: Creating ZMSGraphic Objects
"Dr. Frank Hoffmann" <[email protected]>
| Newsgroups | gmane.comp.cms.zms.devel |
|---|---|
| Message-ID | <42E661C2EF384B84A00A1EC48BAE9758@hal1> |
Hello,
to show the detailed structure of the Zope object, this DTML snippet may
help. It iterates over the attributes of the generic Zope objects contained
by the ZMS Object (result -> appended screenshot).
%<-----------------------------
## SET CONTEXT PATH:
<dtml-with "content.e30.e11209">
<dtml-call f_standard_html_request>
<html>
<body>
<table border="1">
<dtml-let l="objectValues()">
<dtml-in l>
<dtml-let ob=sequence-item>
<dtml-in "operator_getattr(ob,'__dict__').keys()" sort
><dtml-let key=sequence-item
><tr><td valign="top" style="background-color:#eee"><dtml-var
key></td><td>
<dtml-try>
<dtml-var "ob[key]">
<dtml-unless "operator_getattr(ob[key],'__dict__')==None">
<br /><dtml-var "operator_getattr(ob[key],'__dict__')">
</dtml-unless>
<dtml-except>key error
</dtml-try>
</td
></tr>
</dtml-let>
</dtml-in>
</dtml-let>
</dtml-in>
</dtml-let>
</table>
</body>
</html>
</dtml-with>
%<-----------------------------
The class definition of ZMSGraphic you will find in
../zms/zmsgraphic.py
More about the class MyBlob you will find in the Python module and how an
image is transformed into a blobfield (by createBlobField()) :
../zms/_blobfields.py
Best Regards
fh, moderator
-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]]
Im Auftrag von Tobias Greitzke
Gesendet: Dienstag, 24. Juni 2008 11:47
An: [email protected]
Betreff: [zms-developers] Creating ZMSGraphic Objects
Dear ZMS-Developers,
I'm facing some difficulties generating a ZMSGraphic by dtml or python
script. First thing is that I would like to crate a ZMSGraphic by using
a Zope-Photo Object, second to zip-upload images and auto-create thumbnails.
1) So fare I managed to read the image information from the photo object
but I can't figure out how to load it into the ZMSGraphic.
I tried to add the graphic with the following function while "ob"
contains the photo-image file:
manage_addZMSGraphic({'id_prefix':'id','active':1,'img':ob},context.REQUEST)
I could find out that img needs something like a dictionary but I can't
find out how it should look like and what the ZMSGraphic is doing with it.
2) right now zip-uploading images into the mediafolder creates only one
image size. I tried to rewrite the onChangeObjEvt method of the
ZMS-MediaFolder but I can't figure out how to enable the
generate_preview_imghires or generate_preview_imgsuperres.
This is what I tried:
<dtml-call "REQUEST.set('img',manage_addZMSGraphic(
{'id_prefix':'files'
,'active':1
,'generate_preview_imghires:int':1
,'generate_preview_imgsuperres:int':1
,'imgsuperres':ob
},REQUEST))">
ZMS-Version: 2.10.5-23
Thanks
Tobias Greitzke
ZMSGraphic.png
(image/png, 162.4 KB) - not displayed