Changes between Version 4 and Version 5 of CustomUploadAndFilters
- Timestamp:
- Sep 9, 2006, 6:46:41 AM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CustomUploadAndFilters
v4 v5 241 241 Remember to adjust your paths to your project. 242 242 243 Update: Because it's not a very good idea to recreate a thumbnail everytime a page with thumbs is loaded, i've added a if not os.path.exists to the code. But dont forget to Overload the save() function of your Model to delete the thumbnail if the Object changes. 244 243 245 {{{ 244 246 #!python … … 305 307 new_url = add_to_basename(url, extra) 306 308 call_kwargs['save_as'] = os.path.join(settings.MEDIA_ROOT, new_url) 307 308 if crop: 309 # Make the cropping 310 ok = fit_crop(os.path.join(settings.MEDIA_ROOT, url), **call_kwargs) 309 310 if not os.path.exists(call_kwargs['save_as']): 311 if crop: 312 # Make the cropping 313 ok = fit_crop(os.path.join(settings.MEDIA_ROOT, url), **call_kwargs) 314 else: 315 # Create the thumbnail 316 ok = fit(os.path.join(settings.MEDIA_ROOT, url), **call_kwargs) 311 317 else: 312 # Create the thumbnail 313 ok = fit(os.path.join(settings.MEDIA_ROOT, url), **call_kwargs) 314 # 315 318 ok = True 319 # 320 316 321 # Something wrong with the image processing? 317 322 if not ok: