From: Julian F. <ju...@be...> - 2003-02-25 18:01:21
|
vb...@us... wrote: > Update of /cvsroot/mantisbt/mantisbt/core > In directory sc8-pr-cvs1:/tmp/cvs-serv3974/core > > Modified Files: > file_api.php > Log Message: > Fix #838: Show attached images as images instead of links. > > M config_defaults_inc.php > - New config option (preview_attachments_inline_max_size): Configure the maximum size for an attachment to be > viewed inline. This feature can be disabled by setting this value to 0. Default is 0. > > M core/file_api.php > - (file_list_attachments): Added support for attachment previewing. > > Index: file_api.php > =================================================================== > RCS file: /cvsroot/mantisbt/mantisbt/core/file_api.php,v > retrieving revision 1.29 > retrieving revision 1.30 > diff -u -d -r1.29 -r1.30 > --- file_api.php 25 Feb 2003 14:02:26 -0000 1.29 > +++ file_api.php 25 Feb 2003 14:42:50 -0000 1.30 > @@ -43,19 +43,25 @@ > access_has_project_level( config_get( 'handle_bug_threshold' ) ); > > $num_files = db_num_rows( $result ); > + $image_previewed = false; Shouldn't this be $t_image_previewed ? > for ( $i = 0 ; $i < $num_files ; $i++ ) { > $row = db_fetch_array( $result ); > extract( $row, EXTR_PREFIX_ALL, 'v' ); > > - $v_filesize = number_format( $v_filesize ); > - $v_date_added = date( config_get( 'normal_date_format' ), ( $v_date_added ) ); > + $t_filesize = number_format( $v_filesize ); > + $t_date_added = date( config_get( 'normal_date_format' ), ( $v_date_added ) ); > + > + if ( $image_previewed ) { > + $image_previewed = false; > + echo '<br />'; > + } > > $t_href = "<a href=\"file_download.php?file_id=$v_id&type=bug\">"; > > echo $t_href; > print_file_icon ( file_get_display_name( $v_filename ) ); > echo '</a> ' . $t_href . file_get_display_name( $v_filename ) . > - "</a> ($v_filesize bytes) <span class=\"italic\">$v_date_added</span>"; > + "</a> ($t_filesize bytes) <span class=\"italic\">$t_date_added</span>"; > > if ( $t_can_delete ) { > echo " [<a class=\"small\" href=\"bug_file_delete.php?file_id=$v_id\">" . lang_get('delete_link') . '</a>]'; > @@ -63,6 +69,13 @@ > > if ( ( FTP == config_get( 'file_upload_method' ) ) && file_exists ( $v_diskfile ) ) { > echo ' (' . lang_get( 'cached' ) . ')'; > + } > + > + if ( ( $v_filesize <= config_get( 'preview_attachments_inline_max_size' ) ) && > + ( $v_filesize != 0 ) && > + ( in_array( strtolower( file_get_extension( $v_diskfile ) ), array( 'png', 'jpg', 'gif', 'bmp' ), true ) ) ) { > + echo "<br /><img src=\"file_download.php?file_id=$v_id&type=bug\" />"; > + $image_previewed = true; > } > > if ( $i != ($num_files - 1) ) { > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Mantisbt-cvs mailing list > Man...@li... > https://lists.sourceforge.net/lists/listinfo/mantisbt-cvs -- ju...@be... Beta4 Productions (http://www.beta4.com) |