Exporting images

classic Classic list List threaded Threaded
4 messages Options
espen espen
Reply | Threaded
Open this post in threaded view
|

Exporting images

A customer asked me if it is possible to export a certain image size for every image within a folder of images

In other words:

1) Folder "Images" has 30 images.
2) Customer wants the "image_large" size of all images copied to his own PC.

What are my options here ?
Could it be possible to export the content "to a zip-file"?
Could it work with making the defaul view of images "image_large" and copy them via webdav?


Espen

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today.  Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
ajung ajung
Reply | Threaded
Open this post in threaded view
|

Re: Exporting images

Excepts from the Produce & Publish exporter (browser view):


5         # Write ZIP archive$
 46         zip_filename = tempfile.mktemp()$
 47         ZIP = zipfile.ZipFile(zip_filename, 'w')$
 48         # CSS first$
 49         ZIP.writestr('html/publisheddocument.css', css)$


 51         for obj in self.context.getFolderContents():$
 52             obj = obj.getObject()$


71             elif obj.portal_type == 'Image':$
 72                 # export only preview scale$
 73                 img = obj.Schema().getField('image').getScale(obj, scale='preview')$
 74                 ZIP.writestr('html/' + obj.getId(), str(img.data))$


102         ZIP.close()$
103 $
104         data = file(zip_filename).read()$
105         os.unlink(zip_filename) $
106         R = self.request.RESPONSE$
107         R.setHeader('content-type', 'application/zip')$
108         R.setHeader('content-length', len(data))$
109         R.setHeader('content-disposition', 'attachment; filename="%s.zip"' % self.context.getId())$
110         return R.write(data)$
Raphael Ritz Raphael Ritz
Reply | Threaded
Open this post in threaded view
|

Re: Exporting images

On 5/6/11 3:51 PM, ajung wrote:

> Excepts from the Produce&  Publish exporter (browser view):
>
>
> 5         # Write ZIP archive$
>   46         zip_filename = tempfile.mktemp()$
>   47         ZIP = zipfile.ZipFile(zip_filename, 'w')$
>   48         # CSS first$
>   49         ZIP.writestr('html/publisheddocument.css', css)$
>
>
>   51         for obj in self.context.getFolderContents():$
>   52             obj = obj.getObject()$

Is there a reason why this should be preferred over

   for obj in self.context.contentValues()

Just curious,

        Raphael


>
>
> 71             elif obj.portal_type == 'Image':$
>   72                 # export only preview scale$
>   73                 img = obj.Schema().getField('image').getScale(obj,
> scale='preview')$
>   74                 ZIP.writestr('html/' + obj.getId(), str(img.data))$
>
>
> 102         ZIP.close()$
> 103 $
> 104         data = file(zip_filename).read()$
> 105         os.unlink(zip_filename) $
> 106         R = self.request.RESPONSE$
> 107         R.setHeader('content-type', 'application/zip')$
> 108         R.setHeader('content-length', len(data))$
> 109         R.setHeader('content-disposition', 'attachment;
> filename="%s.zip"' % self.context.getId())$
> 110         return R.write(data)$
>
>
> --
> View this message in context: http://plone.293351.n2.nabble.com/Exporting-images-tp6337628p6337645.html
> Sent from the General Questions mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today.  Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd



------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today.  Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
ajung ajung
Reply | Threaded
Open this post in threaded view
|

Re: Exporting images

Raphael Ritz wrote
>
>   51         for obj in self.context.getFolderContents():$
>   52             obj = obj.getObject()$

Is there a reason why this should be preferred over

   for obj in self.context.contentValues()
Just personal coding patterns...never claimed writing perfect code :-)

-aj