Re: On the fly image resize

2013-02-04 Thread Daniele Procida
On Sat, Feb 2, 2013, nYmo  wrote:

>I'm new to django and also python but have already some programming 
>experience. I'm currently creating my first application in django and get 
>stucked because I'm looking for the best way to resize uploaded images.
>I'm already so far that I can upload/delete/update my images and show them 
>in my view. Now I want to resize the images for my view and thought about 
>the best way?
>
>First question: Is it possible to resize the images on the fly? For example 
>I uploaded an image in 1920x1080px and now want to transform it to 400x200 
>or something similar when the view is being loaded? Is this a convenient 
>way in django or not?

It's certainly possible.

I recommend , which is robust and 
well-supported.

Once it has resized an image for you, it will serve up the resized file, until 
something changes (such as the dimensions you require), in which case it will 
create a new copy at the size you want.

It's fast enough at resizing images on the fly that I am often not sure whether 
it is returning an image it has previously resized for that page, or is doing 
it right now. 

I use it with Django Filer, which manages uploaded images. 
. Amongts other things Django 
FIler allows you to mark the part of the image that is important, so that if 
the image is cropped, the important part will not be cut out.

I also use it as part of some other Django software that inspects its own 
templates as they are being rendered, and is able to calculate the corrct size 
of an image wherever it's being placed. Even with all this going on, it seems 
perfectly fast enough to use on the fly.

Daniele

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-03 Thread Sanjay Bhangar
On Mon, Feb 4, 2013 at 6:32 AM, Spencer Summerville  wrote:
> Hello, there are a lot of solutions to resizing images in Django. I commend
> you for wanting to create your own solution, but one of the greatest things
> about Django is that there's tons of projects that people have made that
> solve your problems and usually there's enough of them that you can find one
> that implements itself in a way that lets you do what you want to do. I'm
> not a great programmer and usually these modules are taken from websites
> that in order to function, they have had to work properly in an environment
> where anything can go wrong.
>
> In my own experience, sorl-thumbnail has never let gotten in my way, it lets
> you do what you want and if you want to do something special you can easily
> write your own functionality. Don't want to use PIL? Use ImageMagick or
> write your own class. Have some sort of radical key value cache that nobody
> has ever heard of? Write your own class. Do you want to generate thumbnails
> in a batch process or in the model or in the template? sorl-thumbnail lets
> you choose what you want to do.
>

+1 for sorl. I have been using it for a while now with no significant
problems, and has made thumbnail generation a non-issue.

Sorry for the slightly off-topic statement here, but since we're
talking about Sorl :) - the one problem I've had is this:
In general, I want images to be resized in the format the user uploads
them - i.e. if a user uploads a PNG, I want the thumbnail to be a PNG,
and if the user uploads a JPEG, I want the thumbnail to be a JPEG. It
seems a bit silly, but I have not found a way to do this - I set an
option in settings.py for THUMBNAIL_FORMAT = "PNG", and then all the
thumbnails are PNG, which is non-optimal. And if I set the format to
JPEG, it will take uploaded PNGs with transparencies and convert them
to JPEGs without transparency, which is, again, unacceptable ..

I had looked around a fair bit in the docs, etc. but did not find a
way to specify something like "keep format of uploaded image" - this
was some time ago, though, so I'll check again - if anyone has dealt
with this, though, would love to know how :)

Cheers,
Sanjay



> https://github.com/sorl/sorl-thumbnail
>
>
> On Saturday, February 2, 2013 12:33:36 PM UTC-8, nYmo wrote:
>>
>> Hi all,
>> I'm new to django and also python but have already some programming
>> experience. I'm currently creating my first application in django and get
>> stucked because I'm looking for the best way to resize uploaded images.
>> I'm already so far that I can upload/delete/update my images and show them
>> in my view. Now I want to resize the images for my view and thought about
>> the best way?
>>
>> First question: Is it possible to resize the images on the fly? For
>> example I uploaded an image in 1920x1080px and now want to transform it to
>> 400x200 or something similar when the view is being loaded? Is this a
>> convenient way in django or not?
>>
>> The only other way in my opinion could be to resize the image during the
>> file is being uploaded. What I don't like about this is that I have more
>> than one copy of one image only because of different image sizes.
>>
>> Any other thoughs?
>>
>> I know that there are some nice packages out there where such problems are
>> already solved. But since I'm new to django I want to learn by myself how to
>> accomplish the basic stufff :)
>>
>> Thanks in advance
>>
>> Regards nymo
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-03 Thread Spencer Summerville
Hello, there are a lot of solutions to resizing images in Django. I commend 
you for wanting to create your own solution, but one of the greatest things 
about Django is that there's tons of projects that people have made that 
solve your problems and usually there's enough of them that you can find 
one that implements itself in a way that lets you do what you want to do. 
I'm not a great programmer and usually these modules are taken from 
websites that in order to function, they have had to work properly in an 
environment where anything can go wrong.

In my own experience, sorl-thumbnail has never let gotten in my way, it 
lets you do what you want and if you want to do something special you can 
easily write your own functionality. Don't want to use PIL? Use ImageMagick 
or write your own class. Have some sort of radical key value cache that 
nobody has ever heard of? Write your own class. Do you want to generate 
thumbnails in a batch process or in the model or in the template? 
sorl-thumbnail lets you choose what you want to do.

https://github.com/sorl/sorl-thumbnail

On Saturday, February 2, 2013 12:33:36 PM UTC-8, nYmo wrote:
>
> Hi all, 
> I'm new to django and also python but have already some programming 
> experience. I'm currently creating my first application in django and get 
> stucked because I'm looking for the best way to resize uploaded images.
> I'm already so far that I can upload/delete/update my images and show them 
> in my view. Now I want to resize the images for my view and thought about 
> the best way?
>
> First question: Is it possible to resize the images on the fly? For 
> example I uploaded an image in 1920x1080px and now want to transform it to 
> 400x200 or something similar when the view is being loaded? Is this a 
> convenient way in django or not?
>
> The only other way in my opinion could be to resize the image during the 
> file is being uploaded. What I don't like about this is that I have more 
> than one copy of one image only because of different image sizes. 
>
> Any other thoughs?
>
> I know that there are some nice packages out there where such problems are 
> already solved. But since I'm new to django I want to learn by myself how 
> to accomplish the basic stufff :) 
>
> Thanks in advance
>
> Regards nymo
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-03 Thread nYmo
Thanks Kelly, this looks like what I was looking for. Will give it a 
try. So far my self implementation looks like this:


  def medium_image(self):
return self.get_cache_image_path((400, 400))

def small_image(self):
return self.get_cache_image_path((128, 128))

 def get_cache_image_path(self, size):
"""Create cached image file and return the path to this file"""
#split file path to list to separate folder and file
folder_file = self.image.__str__().split('/')
#get base filename with extension
file_name = folder_file.pop()

#get full folder name
folder_name = "/".join(folder_file)

#extract file extension from file name
extension = file_name[-3:]
#extract clean file name for cached file
cached_file_name = file_name[:-4]
#create unique cached file name from size
cached_file_name += "_%sx%s" % size
cached_file_name += ".%s" % extension

self.create_cached_image_file(cached_file_name, folder_name, size)

#return path to cached file
return settings.MEDIA_URL + folder_name + '/cache/' + 
cached_file_name


 def create_cached_image_file(self, cached_file, folder, cache_file_size):
"""Create cache folder and cache image file but only if they 
don't exist already"""

cached_folder = settings.MEDIA_ROOT + folder + "/cache/"
#if cached folder does not exist create it
if not os.path.isdir(cached_folder):
os.mkdir(cached_folder)

#if file does not exist already then create it
if not os.path.isfile(cached_folder + cached_file):
im = Image.open(self.image.path)
im.thumbnail(cache_file_size, Image.ANTIALIAS)
im.save(cached_folder + cached_file)

This is within my model and in my template I can call 
{{model.medium_image}} or {{model.small_image}}. Works so far but is not 
"DRY" and also still I create a copy of each uploaded image. Will now 
check sorl-thumbnail.




On 02/03/2013 05:49 PM, Kelly Nicholes wrote:
Check out sorl-thumbnail.  https://github.com/sorl/sorl-thumbnail . 
 This lets you specify the desired size in a template.and can deal 
with cropping.  It caches the results so it doesn't have to regenerate 
it each time.


On Saturday, February 2, 2013 1:33:36 PM UTC-7, nYmo wrote:

Hi all,
I'm new to django and also python but have already some
programming experience. I'm currently creating my first
application in django and get stucked because I'm looking for the
best way to resize uploaded images.
I'm already so far that I can upload/delete/update my images and
show them in my view. Now I want to resize the images for my view
and thought about the best way?

First question: Is it possible to resize the images on the fly?
For example I uploaded an image in 1920x1080px and now want to
transform it to 400x200 or something similar when the view is
being loaded? Is this a convenient way in django or not?

The only other way in my opinion could be to resize the image
during the file is being uploaded. What I don't like about this is
that I have more than one copy of one image only because of
different image sizes.

Any other thoughs?

I know that there are some nice packages out there where such
problems are already solved. But since I'm new to django I want to
learn by myself how to accomplish the basic stufff :)

Thanks in advance

Regards nymo

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-03 Thread Kelly Nicholes
Check out sorl-thumbnail.  https://github.com/sorl/sorl-thumbnail .  This 
lets you specify the desired size in a template.and can deal with cropping. 
 It caches the results so it doesn't have to regenerate it each time.

On Saturday, February 2, 2013 1:33:36 PM UTC-7, nYmo wrote:
>
> Hi all, 
> I'm new to django and also python but have already some programming 
> experience. I'm currently creating my first application in django and get 
> stucked because I'm looking for the best way to resize uploaded images.
> I'm already so far that I can upload/delete/update my images and show them 
> in my view. Now I want to resize the images for my view and thought about 
> the best way?
>
> First question: Is it possible to resize the images on the fly? For 
> example I uploaded an image in 1920x1080px and now want to transform it to 
> 400x200 or something similar when the view is being loaded? Is this a 
> convenient way in django or not?
>
> The only other way in my opinion could be to resize the image during the 
> file is being uploaded. What I don't like about this is that I have more 
> than one copy of one image only because of different image sizes. 
>
> Any other thoughs?
>
> I know that there are some nice packages out there where such problems are 
> already solved. But since I'm new to django I want to learn by myself how 
> to accomplish the basic stufff :) 
>
> Thanks in advance
>
> Regards nymo
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-03 Thread nYmo
Thanks to all of you for your thoughs on this. I think I will try to 
build my own solution based on PIL. And then check out a already 
developed plugin and try to improve my own solution.



On 02/03/2013 07:43 AM, mulianto wrote:

hi

you can use pil , python image lib if you take make your own solution.

if want faster solution use other app that do it for you.

you can learn from others source code also and creAte your own solution.



Sent from my iPhone

On 3 Feb 2013, at 04:33, nYmo > wrote:



Hi all,
I'm new to django and also python but have already some programming 
experience. I'm currently creating my first application in django and 
get stucked because I'm looking for the best way to resize uploaded 
images.
I'm already so far that I can upload/delete/update my images and show 
them in my view. Now I want to resize the images for my view and 
thought about the best way?


First question: Is it possible to resize the images on the fly? For 
example I uploaded an image in 1920x1080px and now want to transform 
it to 400x200 or something similar when the view is being loaded? Is 
this a convenient way in django or not?


The only other way in my opinion could be to resize the image during 
the file is being uploaded. What I don't like about this is that I 
have more than one copy of one image only because of different image 
sizes.


Any other thoughs?

I know that there are some nice packages out there where such 
problems are already solved. But since I'm new to django I want to 
learn by myself how to accomplish the basic stufff :)


Thanks in advance

Regards nymo
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, 
send an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-02 Thread mulianto
hi

you can use pil , python image lib if you take make your own solution.

if want faster solution use other app that do it for you.

you can learn from others source code also and creAte your own solution.



Sent from my iPhone

On 3 Feb 2013, at 04:33, nYmo  wrote:

> Hi all, 
> I'm new to django and also python but have already some programming 
> experience. I'm currently creating my first application in django and get 
> stucked because I'm looking for the best way to resize uploaded images.
> I'm already so far that I can upload/delete/update my images and show them in 
> my view. Now I want to resize the images for my view and thought about the 
> best way?
> 
> First question: Is it possible to resize the images on the fly? For example I 
> uploaded an image in 1920x1080px and now want to transform it to 400x200 or 
> something similar when the view is being loaded? Is this a convenient way in 
> django or not?
> 
> The only other way in my opinion could be to resize the image during the file 
> is being uploaded. What I don't like about this is that I have more than one 
> copy of one image only because of different image sizes. 
> 
> Any other thoughs?
> 
> I know that there are some nice packages out there where such problems are 
> already solved. But since I'm new to django I want to learn by myself how to 
> accomplish the basic stufff :) 
> 
> Thanks in advance
> 
> Regards nymo
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-02 Thread Nikhil Verma
Hi

I don't understand your question properly but i think this might help you..


#---
# Calculating the aspect ratio of uploaded profile picture
# It compresses the image accordingly.This has been studided
# from PIL documentation
#---

def handle_uploaded_file(request):
"""
uploading the image
"""
profile_pic = request.FILES['profile_image']
poster_wip = Image.open(profile_pic)
owidth= poster_wip.size[0]
oheight = poster_wip.size[1]
if owidth > oheight:
if oheight <= 200:
pass
else:
maxSize=(200*owidth/oheight, 200)
poster_wip.thumbnail(maxSize, Image.ANTIALIAS)

else:
if owidth <= 150:
pass
else:
maxSize=(150, 150*oheight/owidth)
poster_wip.thumbnail(maxSize, Image.ANTIALIAS)

resized_posterFile = StringIO()
poster_wip.save(resized_posterFile, "PNG")
resized_posterFile.seek(0)

posterFile=InMemoryUploadedFile(resized_posterFile, None,
str(profile_pic), 'image/jpeg', len(resized_posterFile.getvalue()), None)
destination = open(MEDIA_ROOT + '/profile/'+ str(profile_pic), 'wb+')
for chunk in posterFile.chunks():
destination.write(chunk)

destination.close()

return HttpResponse(str(profile_pic))
#---


This is from PIL May be this piece of code can help you.



On Sun, Feb 3, 2013 at 10:49 AM, Babatunde Akinyanmi
wrote:

> Hi nymo,
> I don't know the answer to your question but I can supply some advice.
> One good thing about open source is that the source is available for you
> to look at. Download one of such apps, look at the source to see how to
> creator solved the problem. From there, you can learn a way to do it or get
> inspiration to follow a more efficient or elegant route.
>
> Sent from my Windows Phone
> ------
> From: nYmo
> Sent: 2/2/2013 9:44 PM
> To: django-users@googlegroups.com
> Subject: On the fly image resize
>
> Hi all,
> I'm new to django and also python but have already some programming
> experience. I'm currently creating my first application in django and get
> stucked because I'm looking for the best way to resize uploaded images.
> I'm already so far that I can upload/delete/update my images and show them
> in my view. Now I want to resize the images for my view and thought about
> the best way?
>
> First question: Is it possible to resize the images on the fly? For
> example I uploaded an image in 1920x1080px and now want to transform it to
> 400x200 or something similar when the view is being loaded? Is this a
> convenient way in django or not?
>
> The only other way in my opinion could be to resize the image during the
> file is being uploaded. What I don't like about this is that I have more
> than one copy of one image only because of different image sizes.
>
> Any other thoughs?
>
> I know that there are some nice packages out there where such problems are
> already solved. But since I'm new to django I want to learn by myself how
> to accomplish the basic stufff :)
>
> Thanks in advance
>
> Regards nymo
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




RE: On the fly image resize

2013-02-02 Thread Babatunde Akinyanmi
Hi nymo,
I don't know the answer to your question but I can supply some advice.
One good thing about open source is that the source is available for you to
look at. Download one of such apps, look at the source to see how to
creator solved the problem. From there, you can learn a way to do it or get
inspiration to follow a more efficient or elegant route.

Sent from my Windows Phone
--
From: nYmo
Sent: 2/2/2013 9:44 PM
To: django-users@googlegroups.com
Subject: On the fly image resize

Hi all,
I'm new to django and also python but have already some programming
experience. I'm currently creating my first application in django and get
stucked because I'm looking for the best way to resize uploaded images.
I'm already so far that I can upload/delete/update my images and show them
in my view. Now I want to resize the images for my view and thought about
the best way?

First question: Is it possible to resize the images on the fly? For example
I uploaded an image in 1920x1080px and now want to transform it to 400x200
or something similar when the view is being loaded? Is this a convenient
way in django or not?

The only other way in my opinion could be to resize the image during the
file is being uploaded. What I don't like about this is that I have more
than one copy of one image only because of different image sizes.

Any other thoughs?

I know that there are some nice packages out there where such problems are
already solved. But since I'm new to django I want to learn by myself how
to accomplish the basic stufff :)

Thanks in advance

Regards nymo

-- 
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-02 Thread Mario Gudelj
Try cloudinary and their python api plugin.
On 3 Feb, 2013 7:44 AM, "nYmo"  wrote:

> Hi all,
> I'm new to django and also python but have already some programming
> experience. I'm currently creating my first application in django and get
> stucked because I'm looking for the best way to resize uploaded images.
> I'm already so far that I can upload/delete/update my images and show them
> in my view. Now I want to resize the images for my view and thought about
> the best way?
>
> First question: Is it possible to resize the images on the fly? For
> example I uploaded an image in 1920x1080px and now want to transform it to
> 400x200 or something similar when the view is being loaded? Is this a
> convenient way in django or not?
>
> The only other way in my opinion could be to resize the image during the
> file is being uploaded. What I don't like about this is that I have more
> than one copy of one image only because of different image sizes.
>
> Any other thoughs?
>
> I know that there are some nice packages out there where such problems are
> already solved. But since I'm new to django I want to learn by myself how
> to accomplish the basic stufff :)
>
> Thanks in advance
>
> Regards nymo
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-02 Thread frocco
I use django-imagekit

pip install django-imagekit

On Saturday, February 2, 2013 3:33:36 PM UTC-5, nYmo wrote:
>
> Hi all, 
> I'm new to django and also python but have already some programming 
> experience. I'm currently creating my first application in django and get 
> stucked because I'm looking for the best way to resize uploaded images.
> I'm already so far that I can upload/delete/update my images and show them 
> in my view. Now I want to resize the images for my view and thought about 
> the best way?
>
> First question: Is it possible to resize the images on the fly? For 
> example I uploaded an image in 1920x1080px and now want to transform it to 
> 400x200 or something similar when the view is being loaded? Is this a 
> convenient way in django or not?
>
> The only other way in my opinion could be to resize the image during the 
> file is being uploaded. What I don't like about this is that I have more 
> than one copy of one image only because of different image sizes. 
>
> Any other thoughs?
>
> I know that there are some nice packages out there where such problems are 
> already solved. But since I'm new to django I want to learn by myself how 
> to accomplish the basic stufff :) 
>
> Thanks in advance
>
> Regards nymo
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




On the fly image resize

2013-02-02 Thread nYmo
Hi all, 
I'm new to django and also python but have already some programming 
experience. I'm currently creating my first application in django and get 
stucked because I'm looking for the best way to resize uploaded images.
I'm already so far that I can upload/delete/update my images and show them 
in my view. Now I want to resize the images for my view and thought about 
the best way?

First question: Is it possible to resize the images on the fly? For example 
I uploaded an image in 1920x1080px and now want to transform it to 400x200 
or something similar when the view is being loaded? Is this a convenient 
way in django or not?

The only other way in my opinion could be to resize the image during the 
file is being uploaded. What I don't like about this is that I have more 
than one copy of one image only because of different image sizes. 

Any other thoughs?

I know that there are some nice packages out there where such problems are 
already solved. But since I'm new to django I want to learn by myself how 
to accomplish the basic stufff :) 

Thanks in advance

Regards nymo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.