View Issue Details

IDProjectCategoryView StatusLast Update
0005015mantisbtfeaturepublic2008-10-18 18:34
Reportermhaller Assigned Tograngeway  
PrioritynormalSeveritytweakReproducibilityalways
Status closedResolutionduplicate 
Product Version0.19.0rc1 
Summary0005015: Upload screenshots/screen captures and clipboard images
Description

Upload screenshots/screen captures and clipboard images is currently not possible.

I've seen that in JIRA and love the feature to upload images from system clipboard.

if you need additional information, contact me via info@jupload.biz, i'd like to sponsor the needed applet to Mantis.

TagsNo tags attached.
Attached Files
mantis_jupload_patch.txt (9,328 bytes)   
Index: bug_file_upload_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_file_upload_inc.php,v
retrieving revision 1.36
diff -u -r1.36 bug_file_upload_inc.php
--- bug_file_upload_inc.php	24 Oct 2004 19:04:36 -0000	1.36
+++ bug_file_upload_inc.php	20 Dec 2004 20:27:33 -0000
@@ -50,18 +50,25 @@
 <?php } ?>
 		<?php echo lang_get( 'upload_file' ) ?>
 	</td>
+	<td>
+	</td>
 </tr>
 <tr class="row-1">
 	<td class="category" width="15%">
 		<?php echo lang_get( 'select_file' ) ?><br />
 		<?php echo '<span class="small">(' . lang_get( 'max_file_size' ) . ': ' . number_format( $t_max_file_size/1000 ) . 'k)</span>'?>
 	</td>
-	<td width="85%">
+	<td width="65%">
 		<input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" />
 		<input type="hidden" name="max_file_size" value="<?php echo $t_max_file_size ?>" />
 		<input name="file" type="file" size="40" />
 		<input type="submit" class="button" value="<?php echo lang_get( 'upload_file_button' ) ?>" />
 	</td>
+	<td width="20%">
+	 <span class="small">
+<? print_bracket_link( 'bug_file_upload_advanced.php?bug_id='.$f_bug_id, lang_get( 'advanced_upload' ) ) ?>
+	 </span>
+	</td>
 </tr>
 </table>
 </form>
Index: lang/strings_english.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v
retrieving revision 1.227
diff -u -r1.227 strings_english.txt
--- lang/strings_english.txt	18 Dec 2004 19:32:28 -0000	1.227
+++ lang/strings_english.txt	20 Dec 2004 20:27:45 -0000
@@ -468,6 +468,13 @@
 $s_select_file = 'Select File';
 $s_upload_file_button = 'Upload File';
 $s_max_file_size = 'Max size';
+$s_advanced_upload = 'Advanced upload';
+
+# bug_file_upload_advanced.php
+$s_paste_clipboard = 'Paste Clipboard';
+$s_capture_screen = 'Capture Screen';
+$s_clear_upload_queue = 'Reset';
+$s_upload_files_button = 'Upload Files';
 
 # bug_reopen.php
 $s_bug_reopened_msg = 'Issue has been reopened...';
Index: bug_file_add_advanced.php
===================================================================
RCS file: bug_file_add_advanced.php
diff -N bug_file_add_advanced.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ bug_file_add_advanced.php	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,57 @@
+<?php
+	# Mantis - a php based bugtracking system
+	# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
+	# Copyright (C) 2002 - 2004  Mantis Team   - mantisbt-dev@lists.sourceforge.net
+	# This program is distributed under the terms and conditions of the GPL
+	# See the README and LICENSE files for details
+
+	# --------------------------------------------------------
+	# $Id: bug_file_add.php,v 1.45 2004/10/05 14:59:08 thraxisp Exp $
+	# Contributed by Mike Haller <info@jupload.biz>
+	# --------------------------------------------------------
+?>
+<?php
+	# Add file to a bug and then view the bug
+?>
+<?php
+	require_once( 'core.php' );
+	
+	$t_core_path = config_get( 'core_path' );
+	
+	require_once( $t_core_path.'file_api.php' );
+?>
+<?php
+	$f_bug_id	= gpc_get_int( 'bug_id' );
+	
+	if ( ! file_allow_bug_upload( $f_bug_id ) ) {
+		access_denied();
+	}
+
+	access_ensure_bug_level( config_get( 'upload_bug_file_threshold' ), $f_bug_id );
+
+
+	foreach($_FILES as $f_file)
+	{
+		if ( !is_uploaded_file( $f_file['tmp_name'] ) || 0 == $f_file['size'] ) {
+			trigger_error( ERROR_UPLOAD_FAILURE, ERROR );
+		}
+
+		file_add( $f_bug_id, $f_file['tmp_name'], $f_file['name'], $f_file['type'], 'bug' );
+	}
+
+	# Determine which view page to redirect back to.
+	$t_redirect_url = string_get_bug_view_url( $f_bug_id );
+
+	html_page_top1();
+	html_meta_redirect( $t_redirect_url );
+	html_page_top2();
+?>
+<br />
+<div align="center">
+<?php
+	echo lang_get( 'operation_successful' ) . '<br />';
+	print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
+?>
+</div>
+
+<?php html_page_bottom1( __FILE__ ) ?>
Index: bug_file_upload_advanced.php
===================================================================
RCS file: bug_file_upload_advanced.php
diff -N bug_file_upload_advanced.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ bug_file_upload_advanced.php	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,167 @@
+<?php
+	# Mantis - a php based bugtracking system
+	# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
+	# Copyright (C) 2002 - 2004  Mantis Team   - mantisbt-dev@lists.sourceforge.net
+	# This program is distributed under the terms and conditions of the GPL
+	# See the README and LICENSE files for details
+
+	# --------------------------------------------------------
+	# $Id$
+	# Contributed by Mike Haller <info@jupload.biz>
+	# --------------------------------------------------------
+?>
+<?php
+	require_once( 'core.php' );
+	
+	$t_core_path = config_get( 'core_path' );
+	
+	require_once( $t_core_path.'bug_api.php' );
+	require_once( $t_core_path.'custom_field_api.php' );
+	require_once( $t_core_path.'compress_api.php' );
+	require_once( $t_core_path.'current_user_api.php' );
+	require_once( $t_core_path.'file_api.php' );
+	require_once( $t_core_path.'date_api.php' );
+	require_once( $t_core_path.'relationship_api.php' );
+?>
+<?php
+	$f_bug_id	= gpc_get_int( 'bug_id' );
+	$f_history	= gpc_get_bool( 'history', config_get( 'history_default_visible' ) );
+
+	if ( ADVANCED_ONLY == config_get( 'show_view' ) ) {
+		print_header_redirect ( 'bug_view_advanced_page.php?bug_id=' . $f_bug_id );
+	}
+
+	access_ensure_bug_level( VIEWER, $f_bug_id );
+
+	$t_bug = bug_prepare_display( bug_get( $f_bug_id, true ) );
+
+	$t_access_level_needed = config_get( 'view_history_threshold' );
+	$t_can_view_history = access_has_bug_level( $t_access_level_needed, $f_bug_id );
+
+	compress_enable();
+
+	$t_bugslist = gpc_get_cookie( config_get( 'bug_list_cookie' ), false );
+?>
+<?php html_page_top1( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) ) ?>
+<?php html_page_top2() ?>
+
+<div id="upload_form_open">
+
+<form name="JUploadForm">
+		<input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" />
+		<input type="hidden" name="max_file_size" value="<?php echo $t_max_file_size ?>" />
+</form>
+
+<table class="width100" cellspacing="1">
+
+	<!-- Title -->
+	<tr>
+		<td class="form-title" colspan="3">
+			<?php echo lang_get( 'advanced_upload' ) ?>
+		</td>
+	</tr>
+
+	<!-- spacer -->
+	<tr height="5" class="spacer">
+		<td colspan="3"></td>
+	</tr>
+
+	<tr>
+		<td>
+			<input
+			 type="button"
+			 value="<?php echo lang_get( 'paste_clipboard' ) ?>"
+			 onClick="document.JUpload.jsPasteClipboardImage()">
+		</td>
+		<td>
+			<input
+			 type="button"
+			 value="<?php echo lang_get( 'capture_screen' ) ?>"
+			 onClick="document.JUpload.jsCaptureScreenshot()">
+		</td>
+		<td width="*">
+		</td>
+	</tr>
+
+	<tr>
+		<td colspan="3">
+			 <applet 
+			  code="JUpload.startup"
+			  archive="lib/jupload.jar"
+			  width="200"
+			  height="60"
+			  mayscript="mayscript"
+			  name="JUpload"
+			  alt="JUpload by www.jupload.biz">
+			 <!-- Java Plug-In Options -->
+			 <param name="progressbar" value="true">
+			 <param name="boxmessage" value="Loading JUpload Applet ...">
+			 <!-- Target links -->
+			 <param name="actionURL" value="bug_file_add_advanced.php">
+			 <param name="completeURL" value="view.php?id=<? echo $f_bug_id ?>">
+			 <param name="backgroundColor" value="#ffffff">
+			 <param name="captureScreen" value="true">
+			 <param name="replaceDocument" value="false">
+			 <param name="realTimeResponse" value="false">
+             <param name="showSuccessDialog" value="false">
+			 <param name="showServerResponse" value="false">
+			 <param name="showStatusPanel" value="false">
+			 <param name="autoselectLastFile" value="true">
+			 <!param name="dimensionFilter" value="((width>=640 and width<=1024) and (height>=480 and height <= 768)) or ((width>=480 and width<=768) and (height>=640 and height <= 1024)) or (width=-1 and height=-1)">
+			 <param name="debug" value="false">
+			 </applet>
+		</td>
+	</td>
+
+	<!-- spacer -->
+	<tr height="5" class="spacer">
+		<td colspan="3"></td>
+	</tr>
+
+	<tr>
+		<td>
+			<input
+			 type="button"
+			 value="<?php echo lang_get( 'clear_upload_queue' ) ?>"
+			 onClick="document.JUpload.jsClickRemove()">
+		</td>
+		<td>
+			<input
+			 type="button"
+			 value="<?php echo lang_get( 'upload_files_button' ) ?>"
+			 onClick="document.JUpload.jsClickUpload()">
+		</td>
+		<td>
+		</td>
+	</td>
+
+	<!-- spacer -->
+	<tr height="5" class="spacer">
+		<td colspan="3"></td>
+	</tr>
+
+	<tr>
+		<td colspan="3">
+			<applet 
+			  code="JUploadPlugin_ImagePreview"
+			  archive="lib/jupload.jar"
+			  width="480"
+			  height="320"
+			  mayscript="mayscript"
+			  name="JUploadPlugin_ImagePreview"
+			  alt="JUpload Plugin: Image preview">
+			 <param name="backgroundColor" value="#ffffff">
+			</applet>
+		</td>
+	</tr>
+	<!-- spacer -->
+	<tr height="5" class="spacer">
+		<td colspan="3"></td>
+	</tr>
+</table>
+</form>
+</div>
+
+<?
+	html_page_bottom1( __FILE__ );
+?>
mantis_jupload_patch.txt (9,328 bytes)   

Relationships

duplicate of 0007053 acknowledged Mantis Plugin for Cropper (a free screen capture utility for Windows) 
related to 0005227 new Feature rqst: Automatic conversion of attached screendumps to Jpeg, PNG or GIF 
related to 0007288 closedatrol Add Functionality to paste a screen shot 
related to 0008659 closedatrol Snap-shot 
child of 0004937 closedvboctor Mantis 1.0.0a1 Release 

Activities

jlatour

jlatour

2004-12-19 18:17

reporter   ~0008727

Sounds interesting. Could you also take care of the integration into Mantis?

mhaller

mhaller

2004-12-19 18:32

reporter   ~0008730

sure, should be no problem. i'll try to create a patch this week.
if mantis is using standard PHP functions ($_FILES, move_uploaded_file() etc.), there should be no problem.

jlatour

jlatour

2004-12-20 01:05

reporter   ~0008733

It is, but please take a look at the coding guidelines.

mhaller

mhaller

2004-12-20 14:30

reporter   ~0008744

Last edited: 2004-12-20 14:39

apply the attached patch, then get jupload.jar (from http://jupload.biz/files/jupload.zip) and copy it into a folder "lib/" in the mantis root directory.

i tried to upload the jar file, but it seems to be too large (200kb)

TODO:

  • better layout of buttons
  • browser check (is java enabled?)
mgerben

mgerben

2005-02-10 04:28

reporter   ~0009279

Please have a look at 0005227 ; It would save a lot of bandwidth and upload if the images were stored in a slightly more efficient format than BMP.
PNG or colour-depth reduction would be fine for screenshots; JPG would not be fine for screenshots, btw.

mgerben

mgerben

2005-02-10 08:34

reporter   ~0009280

I hacked a little change in the file_api: If an uploaded file is a BMP file, it is converted to a PNG file.
Only a few lines, and it does what I want it to do. It's based on ImageMagick which is available on many platforms.
It really is a hack, but it works for me. A 2MB screendump is converted to file of 29KB (wow. PNG rules).

I think that the Java-applet mentioned in this patch should do this if possible (saves bandwidth), but if anybody is interested, mail me. mgerben@yahoo.com

grangeway

grangeway

2008-07-28 14:06

reporter   ~0018748

Thank you for taking the time to report a problem with mantis.

Since this problem report was originally made, a number of releases have occured. Additionally no recent feedback has been received on this issue.
It appears that this issue has either been fixed, or may not be a relevant report for the current release.

Unfortunately you are not using the latest version and the problem might already be fixed. Please download the latest release from http://www.mantisbt.org/download.php [^] [^]

If you are able to reproduce this bug in the current release, or have some more information on how this feature could be improved in the current release. Please either change the mantis version on this bug report
to the version you tested and change the status back to "Open", or open a new issue report with more information.

Again, thank you for your continued support and report.