Page 1 of 1
View Attachments in Browser Instead of Downloading Them
Posted: 28 Aug 2008, 16:53
by kuhsay
Is there a setting in the config file to make mantis view a file in the browser instead of downloading it? Specifically I want to view .png, .jpg, or .gif files directly in firefox.
Most of the attachments to bugs we submit are screenshots, and if I click a screenshot attachment it brings up the "Open With" or "Save to Disk" dialog. Then I have to open it in Paint or Picture viewer.
On Macs the problem is worsened, because even when you opt to "Open' the file instead of 'Save to Disk', it saves the image to the desktop and then opens it, resulting in a very cluttered desktop.
The closest answer to this I was able to find is this post:
http://www.mantisbt.org/forums/viewtopi ... wser#p1592 but I was wondering if there was a better way to do it without hacking the core.
Re: View Attachments in Browser Instead of Downloading Them
Posted: 29 Aug 2008, 07:12
by deboutv
Take a look at the configuration variables:
Code: Select all
############################
# Bug Attachments Settings
############################
# Specifies the maximum size below which an attachment is previewed in the bug
# view pages. To disable this feature, set max size to 0.
# This feature applies to: bmp, png, gif, jpg
$g_preview_attachments_inline_max_size = 0;
# Extenstions for text files that can be expanded inline.
$g_preview_text_extensions = array( 'txt', 'diff', 'patch' );
# Extensions for images that can be expanded inline.
$g_preview_image_extensions = array( 'bmp', 'png', 'gif', 'jpg', 'jpeg' );
# Specifies the maximum width for the auto-preview feature. If no maximum width should be imposed
# then it should be set to 0.
$g_preview_max_width = 0;
# Specifies the maximum height for the auto-preview feature. If no maximum height should be imposed
# then it should be set to 0.
$g_preview_max_height = 250;
# --- Show an attachment indicator on bug list ---
# Show a clickable attachment indicator on the bug
# list page if the bug has one or more files attached.
# Note: This option is disabled by default since it adds
# 1 database query per bug listed and thus might slow
# down the page display.
$g_show_attachment_indicator = OFF;
# access level needed to view bugs attachments. View means to see the file names
# sizes, and timestamps of the attachments.
$g_view_attachments_threshold = VIEWER;
# list of filetypes to view inline. This is a string of extentions separated by commas
# This is used when downloading an attachment. Rather than downloading, the attachment
# is viewed in the browser.
$g_inline_file_exts = 'gif,png';
# access level needed to download bug attachments
$g_download_attachments_threshold = VIEWER;
# access level needed to delete bug attachments
$g_delete_attachments_threshold = DEVELOPER;
# allow users to view attachments uploaded by themselves even if their access
# level is below view_attachments_threshold.
$g_allow_view_own_attachments = ON;
# allow users to download attachments uploaded by themselves even if their access
# level is below download_attachments_threshold.
$g_allow_download_own_attachments = ON;
# allow users to delete attachments uploaded by themselves even if their access
# level is below delete_attachments_threshold.
$g_allow_delete_own_attachments = OFF;
Re: View Attachments in Browser Instead of Downloading Them
Posted: 29 Aug 2008, 15:31
by kuhsay
Thank you.
I noticed that $g_inline_file_exts = 'gif,png'; is a case sensitive list. For example, I set this to 'gif,png,jpg' and files that were named 'myattachment.JPG' would still download. I had to modify the list to 'gif,png,jpg,JPG' to view them in my browser.
I would submit this as a bug to make it case insensitive, but I'm still using version 1.1.1... I'm not sure if this exists in 1.1.2. Would someone please confirm?