These learning resources primarily focus on programming using Good Design Principles and Design Patterns
- There is an emphasis on learning using PHP, although most patterns are universal to every object orientated language.
// default exports
export default 42;
export default {};
export default [];
export default (1 + 2);
export default foo;
export default function () {}
export default class {}
export default function foo () {}| #Resizes an image and keeps aspect ratio. Set mywidth to the desired with in pixels. | |
| import PIL | |
| from PIL import Image | |
| mywidth = 300 | |
| img = Image.open('someimage.jpg') | |
| wpercent = (mywidth/float(img.size[0])) | |
| hsize = int((float(img.size[1])*float(wpercent))) |
| # Extension of http://www.yilmazhuseyin.com/blog/dev/create-thumbnails-imagefield-django/ | |
| # Note: image_folder and thumbnail_folder are both a callable (ie. a lambda that does a '/'.join()) | |
| class Image(Media): | |
| image = models.ImageField( | |
| upload_to=image_folder | |
| ) | |
| thumbnail = models.ImageField( |