title: Django / PIL - save thumbnail version right when image is uploaded
body: <p>This is my forms.py:</p>
  
  <pre><code>class UploadImageForm(forms.ModelForm):
      class Meta:
          model = UserImages
          fields = ['photo']
  </code></pre>
  
  <p>and this is my models.py:</p>
  
  <pre><code>class UserImages(models.Model):
      user = models.ForeignKey(User)
      photo = models.ImageField(upload_to=get_file_path)
  </code></pre>
  
  <p>and this is my view:</p>
  
  <pre><code>def uploadImageView(request):
      if request.method == 'POST':
          form = UploadImageForm(request.POST, request.FILES)
          if form.is_valid():
              instance = form.save(commit=False)
              instance.user = request.user
              instance.save()
              return redirect('/')
      else:
          form = UploadImageForm()
  
      return render(request, 'uploadImagePage.html', {'uploadImageForm': form})
  </code></pre>
  
  <p>But this only saves the image being uploaded. How do I save a thumbnail version of the image as well with the thumbnail version of the image having the exact same name except with the word 'thumbail' after it?</p>
  
  <p>The tutorials I read said I can do</p>
  
  <pre><code>im = Image.open(infile)
  im.thumbnail(size, Image.ANTIALIAS)
  </code></pre>
  
  <p>to get a thumbnail but in my situation, the image isn't even saved yet.</p>