Views
Racine Index / App / Browser / Views
Auto-generated documentation for app.browser.views module.
FileTile
Signature
angle_from_request
Signature
check_stored_file
Checks file size and SHA-256 hash for an upload and looks for duplicates in the database.
If a duplicate is found, delete this upload and return the duplicate.
NB: this means that if we upload two attachments with identical content but different names, the downloaded file will have the name of the first uploaded file
This is separate from the store_file function, because store_file is specific to images right now and we might want to use the duplicate check for other file types, too (in the future).
Parameters
upload : Upload
Returns
upload : Upload The upload or its duplicate.
Signature
imagebrowser
Signature
@browser.route("/", defaults={"smb_path": ""})
@browser.route("/<path:smb_path>")
@login_required
def imagebrowser(smb_path): ...
inspectpath
Signature
inspectresource
Signature
make_preview
Signature
make_rotated
Signature
retrieve_attachment
Retrieves an attachment that was uploaded to the server.
Parameters
upload_id : int The ID of the attachment to be retrieved, corresponding to a row in the uploads database table.
Signature
retrieve_image
Retrieves an image that was uploaded to the server,
either by uploading through the browser or by transfer from a SMB resource. The POST request is used by the CKEditor plugin imagerotate to retrieve potential error messages.
Parameters
upload_id : int The ID of the image to be retrieved, corresponding to a row in the uploads database table.
Signature
@browser.route("/ulimg/<upload_id>", methods=["GET", "POST"])
@login_required
def retrieve_image(upload_id): ...
retrieve_image_error
Signature
retrieve_smb_image
Retrieves an image from a SMB resource. This is only for the browser, so we will send back thumbnails to speed up the communication a bit.
Parameters
path : str The path to the image, consisting of the name of the SMB resource and the address within the resource.
Signature
save_from_smb
Signature
store_attachment
Stores an image file in the upload database and saves it in the upload folder, checking for duplicates.
Parameters
file_obj : FileStorage object or any other object with save() function source : str ext : str
Returns
upload : Upload object or None message : str upload URL if upload succeeds or error message if it fails
Signature
store_file
Stores a file in the upload database and saves it in the upload folder, checking for duplicates.
Parameters
file_obj : FileStorage or Image object, or any other object with save() function source : str ext : str type : str 'img' or 'att'
Returns
upload : Upload object or None message : str upload URL if upload succeeds or error message if it fails
Signature
store_image
Stores an image file in the upload database and saves it in the upload folder, checking for duplicates.
Parameters
file_obj : file object source : str ext : str
Returns
upload : Upload object or None message : str upload URL if upload succeeds or error message if it fails dimensions : tuple (width, height) of the image