[web2py] thumbnails plugin updated

2015-06-26 Thread Carlos Cesar Caballero Díaz
Hi, again post this to the list because of my imposibility to upload 
plugins to web2pyslices.


I have updated my thumbnails plugin, and now we can use the use_imageops 
option to crop the original image and fit the desired proportion, there 
is other minor updates, the project url is: 
https://github.com/cccaballero/web2py-thumbnails


In the next updates I will work to use the plugin manager.

Cheers.

--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Thumbnails

2015-04-14 Thread Gael Princivalle
.. yes two years later as making thumbnails still useful!!
Thanks Niphlod, I'll do it with path.join call. Anyway the error was in the 
path, static/uploads instead of uploads.

Il giorno martedì 14 aprile 2015 16:56:00 UTC+2, Niphlod ha scritto:
>
> 2 years later ?!
>
> for starters, PLEASE don't concatenate paths as strings and use a proper 
> os.path.join call 
>
> On Tuesday, April 14, 2015 at 4:53:14 PM UTC+2, Gael Princivalle wrote:
>>
>> Hi.
>>
>> If I click on the file link I obtain:
>>
>> https://my_domain.com/my_app/appadmin/download/db/%5BErrno%202%5D%20No%20such%20file%20or%20directory:%20%27/home/my_folder/webapps/w2p_2_9_12_dev/web2py/applications/my_app/static/uploads/my_table.my_image.844c80079e794fbd.62726f777361626c655f636174616c6f6775652e6a7067.jpg%27
>>
>> It seems that the my_image path is wrong, but I think it's not.
>>
>> db.define_table('my_table',
>> Field('my_image', 'upload'),
>> Field('my_image_thumb', 'upload'))
>>
>> from PIL import Image
>>
>> def resize_image(image, size, path, rotate=0):
>> if image:
>> try:
>> img = Image.open('%sstatic/uploads/%s' % (request.folder, 
>> image))
>> img = img.convert("RGB")
>> img.thumbnail(size, Image.ANTIALIAS)
>> img = img.rotate(rotate)
>> root, ext = os.path.splitext(image)
>> filename = '%s_%s%s' %(root, path, ext)
>> img.save('%sstatic/uploads/%s' % (request.folder, filename))
>> return filename
>> except Exception, e:
>> return e
>> else:
>> return None
>>
>> db.my_table.my_image_thumb.compute = lambda r: resize_image(r['my_image'
>> ], (250,140), 'thumb')
>>
>>
>> Do you have an idea?
>>
>> Il giorno giovedì 1 marzo 2012 01:32:03 UTC+1, pbreit ha scritto:
>>>
>>> Oops, make sure to import PIL:
>>>
>>> from PIL import Image
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Thumbnails

2015-04-14 Thread Gael Princivalle
Hi.

If I click on the file link I obtain:
https://my_domain.com/my_app/appadmin/download/db/%5BErrno%202%5D%20No%20such%20file%20or%20directory:%20%27/home/my_folder/webapps/w2p_2_9_12_dev/web2py/applications/my_app/static/uploads/my_table.my_image.844c80079e794fbd.62726f777361626c655f636174616c6f6775652e6a7067.jpg%27

It seems that the my_image path is wrong, but I think it's not.

db.define_table('my_table',
Field('my_image', 'upload'),
Field('my_image_thumb', 'upload'))

from PIL import Image

def resize_image(image, size, path, rotate=0):
if image:
try:
img = Image.open('%sstatic/uploads/%s' % (request.folder, image
))
img = img.convert("RGB")
img.thumbnail(size, Image.ANTIALIAS)
img = img.rotate(rotate)
root, ext = os.path.splitext(image)
filename = '%s_%s%s' %(root, path, ext)
img.save('%sstatic/uploads/%s' % (request.folder, filename))
return filename
except Exception, e:
return e
else:
return None

db.my_table.my_image_thumb.compute = lambda r: resize_image(r['my_image'], (
250,140), 'thumb')


Do you have an idea?

Il giorno giovedì 1 marzo 2012 01:32:03 UTC+1, pbreit ha scritto:
>
> Oops, make sure to import PIL:
>
> from PIL import Image
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Thumbnails

2015-04-14 Thread Niphlod
2 years later ?!

for starters, PLEASE don't concatenate paths as strings and use a proper 
os.path.join call 

On Tuesday, April 14, 2015 at 4:53:14 PM UTC+2, Gael Princivalle wrote:
>
> Hi.
>
> If I click on the file link I obtain:
>
> https://my_domain.com/my_app/appadmin/download/db/%5BErrno%202%5D%20No%20such%20file%20or%20directory:%20%27/home/my_folder/webapps/w2p_2_9_12_dev/web2py/applications/my_app/static/uploads/my_table.my_image.844c80079e794fbd.62726f777361626c655f636174616c6f6775652e6a7067.jpg%27
>
> It seems that the my_image path is wrong, but I think it's not.
>
> db.define_table('my_table',
> Field('my_image', 'upload'),
> Field('my_image_thumb', 'upload'))
>
> from PIL import Image
>
> def resize_image(image, size, path, rotate=0):
> if image:
> try:
> img = Image.open('%sstatic/uploads/%s' % (request.folder, 
> image))
> img = img.convert("RGB")
> img.thumbnail(size, Image.ANTIALIAS)
> img = img.rotate(rotate)
> root, ext = os.path.splitext(image)
> filename = '%s_%s%s' %(root, path, ext)
> img.save('%sstatic/uploads/%s' % (request.folder, filename))
> return filename
> except Exception, e:
> return e
> else:
> return None
>
> db.my_table.my_image_thumb.compute = lambda r: resize_image(r['my_image'], 
> (250,140), 'thumb')
>
>
> Do you have an idea?
>
> Il giorno giovedì 1 marzo 2012 01:32:03 UTC+1, pbreit ha scritto:
>>
>> Oops, make sure to import PIL:
>>
>> from PIL import Image
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] thumbnails plugin

2014-05-15 Thread Carlos Cesar Caballero Díaz
Hi, I uploaded it to github 
(https://github.com/cccaballero/web2py-thumbnails), there are sources 
and some instructions.


--

Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] thumbnails plugin

2014-05-09 Thread Carlos A. Armenta Castro
I'll try it, it was ir looking For.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] thumbnails plugin

2014-05-09 Thread Carlos Cesar Caballero Díaz

Hi, this is a first aproach of a thumbnails plugin, needs PIL to work.
Any recomendations will be apreciated (I don't like so much what I am 
doing with the database)



--

Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


web2py.plugin.thumbnails.w2p
Description: Binary data


Re: [web2py] Thumbnails

2012-02-29 Thread pbreit
Oops, make sure to import PIL:

from PIL import Image


Re: [web2py] Thumbnails

2012-02-29 Thread pbreit
I like the module approach. I just put the function in my model file like 
this:

db.item.image_thumb.compute = lambda r: resize_image(r['image'], (150,130), 
'thumb')
db.item.image_display.compute = lambda r: resize_image(r['image'], 
(320,320), 'display')

def resize_image(image, size, path, rotate=0):
if image:
try:
img = Image.open('%sstatic/uploads/%s' % (request.folder, 
image))
img = img.convert("RGB")
img.thumbnail(size, Image.ANTIALIAS)
img = img.rotate(rotate)
root, ext = os.path.splitext(image)
filename = '%s_%s%s' %(root, path, ext)
img.save('%sstatic/uploads/%s' % (request.folder, filename))
return filename
except Exception, e:
return e
else:
return None


Re: [web2py] Thumbnails

2012-02-28 Thread Bruno Rocha
I do it using the compute attribute, take a look:
http://movu.ca/demo/article/show/36/creating-thumbnails-with-web2py

On Tue, Feb 28, 2012 at 3:32 PM, Ivan Vilches Basaul <
ivan_vilc...@hotmail.com> wrote:

> Any way for automatic thumbnails creation?
> Thanks
>
> Ivan Vilches Basaul
>
>


-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] Thumbnails

2012-02-28 Thread Ivan Vilches Basaul
Any way for automatic thumbnails creation? 
Thanks 

Ivan Vilches Basaul