Recent Topics

1 Jul 05, 2010 13:47    

My b2evolution Version: Not Entered

I do not want image attachments to be rendered/displayed, i want them to stay as a regular link to the file like the other file formats..

I mean what's the point of that ? If i wanted to display that image attachment in the post, i would insert it already not 'attach' it..

How do i override this

2 Jul 05, 2010 15:27

echo preg_replace( '~<img.+?alt="(.+?)".+?/>~', '$1', $Item->get_images( array() ) );

ish

¥

3 Jul 05, 2010 15:32

¥åßßå wrote:

echo preg_replace( '~<img.+?alt="(.+?)".+?/>~', '$1', $Item->get_images( array() ) );

ish

¥

where the hell do i put that? have no clue. why arent you on irc btw, did your machine finally melt down ?

4 Jul 05, 2010 15:33

It rebooted and I forgot to restart irc ;)

Replace $Item->images() in you _item.content.inc.php

¥

5 Jul 05, 2010 16:36

ok, after a short irc session, the solution (thanks to is to ¥åßßå ) is to hack the core ..inc/items/model/_item.class.php file in two lines -see the comments-;


	/**
	 * Get block of attachments/files linked to the current Item
	 *
	 * @param array Array of params
	 * @param string Output format, see {@link format_to_output()}
	 * @return string HTML
	 */
	function get_files( $params = array(), $format = 'htmlbody' )
	{
		$params = array_merge( array(
				'before' =>              '<ul class="bFiles">',
				'before_file' =>         '<li>',
				'before_file_size' =>    ' <span class="file_size">',
				'after_file_size' =>     '</span>',
				'after_file' =>          '</li>',
				'after' =>               '</ul>',
			// fp> TODO: we should only have one limit param. Or is there a good reason for having two?
			// sam2kb> It's needed only for flexibility, in the meantime if user attaches 200 files he expects to see all of them in skin, I think.
				'limit_files' =>         1000, // Max # of files displayed
				'limit' =>               1000,
//line to edit #1
				'ignore_images'            =>  true,
			), $params );

		// Get list of attached files
		$FileList = $this->get_attachment_FileList( $params['limit'] );

		load_funcs('files/model/_file.funcs.php');

		$r = '';
		$i = 0;
		$r_file = array();
		/**
		 * @var File
		 */
		$File = NULL;
		while( ( $File = & $FileList->get_next() ) && $params['limit_files'] > $i )
		{
//line to edit #2
			if( $File->is_image() &&  param['ignore_images'])
			{	// Skip images because these are displayed inline already
				// fp> TODO: have a setting for each linked file to decide whether it should be displayed inline or as an attachment
				continue;
			}

and adding 'ignore_images' => false parameter in your ...skins/_item_content.inc.php file. Such as;

		if( !empty($params['limit_files']) )
		{	// Display attachments/files that are linked to this post:
			$Item->files( array(
					'before' =>              $params['file_list_start'],
					'before_file' =>         $params['file_start'],
					'before_file_size' =>    $params['before_file_size'],
					'after_file_size' =>     $params['after_file_size'],
					'after_file' =>          $params['file_end'],
					'after' =>               $params['file_list_end'],
					'limit_files' =>         $params['limit_files'],
					'ignore_images' => false,
				) );
			
		}

6 Jul 05, 2010 18:08

Just for kicks, corrected regex version for people who just want linked images as links ;)

echo preg_replace( '~<img.+?\.evocache/([^/]+?)/.+?/>~', '$1', $Item->get_images( array(
                        'before' => $params['before_images'],
                        'before_image' => $params['before_image'],
                        'before_image_legend' => $params['before_image_legend'],
                        'after_image_legend' => $params['after_image_legend'],
                        'after_image' => $params['after_image_legend'],
                        'after' => $params['after_images'],
                        'image_size' => $params['image_size'],
                ) ) );

¥


Form is loading...