Created
November 11, 2012 15:45
-
-
Save DarkSector/4055272 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @app.route('/panel/product/upload/image', methods=['POST']) | |
| def upload_product_image(): | |
| image_name = flask.request.args['qqfile'] | |
| product_image_path = os.path.join(app_config('PRODUCT_IMAGES'), image_name) | |
| product_thumbnail_path = os.path.join(app_config('PRODUCT_IMAGES_THUMBNAILS'), image_name) | |
| with open(product_image_path, 'w') as fh: | |
| fh.write(flask.request.stream.read()) | |
| im = Image.open(product_image_path) | |
| with open(product_thumbnail_path, 'w') as fh: | |
| image_resize(im, (100, 100), False, fh) | |
| return flask.jsonify(success = True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment