Page 1 of 1
Resize Screenshots
Posted: 27 Feb 2007, 15:41
by smlp
We have Mantis confgured that attached screenshots are automatically displayed in the bug page.
But out users tend to attach large screenshots, I would like mantis resize them automatically if they're above a specified resolution (I think this can be done with width/height attributes of the img tag).
Someone knows if this is already included in Mantis or an easy way to do it?
Regards,
Sebastian
Posted: 27 Feb 2007, 17:54
by Narcissus
I don't think that there's a setting for that exactly, but you can set Mantis to not show attachments inline once they are bigger than a certain size on disk.
You can set $g_preview_attachments_inline_max_size in your config_inc.php file to do this.
Posted: 06 Mar 2007, 16:14
by smlp
This can easily be done by modifying the file_list_attachments function of file_api.php and adding a "width" attribute to the <img> tag.
It would be nice if you could add something like this to the code and add the width as a parameter to the config.
Here is a patch for Mantis 1.0.5 that scales the displayed image to 800 pixel width:
Code: Select all
*** file_api.php.bak Tue Mar 6 17:31:32 2007
--- file_api.php Tue Mar 6 17:31:32 2007
***************
*** 188,194 ****
( $v_filesize != 0 ) &&
( in_array( strtolower( file_get_extension( $t_file_display_name ) ), array( 'png', 'jpg', 'jpeg', 'gif', 'bmp' ), true ) ) ) {
! PRINT "<br /><img src=\"file_download.php?file_id=$v_id&type=bug\" />";
$image_previewed = true;
}
--- 188,194 ----
( $v_filesize != 0 ) &&
( in_array( strtolower( file_get_extension( $t_file_display_name ) ), array( 'png', 'jpg', 'jpeg', 'gif', 'bmp' ), true ) ) ) {
! PRINT "<br /><img width=\"800\" src=\"file_download.php?file_id=$v_id&type=bug\" />";
$image_previewed = true;
}