Recent Topics

1 Dec 02, 2008 09:45    

My b2evolution Version: 2.x

Hi again,

Is it possible to have an image plugin that will take the first image loaded to a post to be converted into a thumbnail image that will show on the main page next to the post?

My second question is - Is it possible to make a plugin that would allow users to upload their images straight to my server? While also allowing the user to choose from a few specified sizing options? For example - 400 pixels, 200 pixels, 100 pixels, or 100% .

Thanks for any help
Gene :-)

2 Dec 02, 2008 16:28

For the first question:

Create new file conf/hacks.php with the following code

<?php

// Get File by Item ID
function get_File_by_item_ID( $Item_ID, $file_number = 0 )
{
	$FileCache = & get_Cache( 'FileCache' );

	$SQL = & new SQL();    
	$SQL->SELECT( 'link_ID, link_ltype_ID, file_ID, file_title, file_root_type, file_root_ID, file_path, file_alt, file_desc' );
	$SQL->FROM( 'T_links LEFT JOIN T_files ON link_file_ID = file_ID' );
	$SQL->WHERE( 'link_itm_ID = '.$Item_ID );
	$SQL->ORDER_BY( 'link_ID' );

	$Results = & new Results( $SQL->get(), 'link_' );
	$Results->query( false, false, false );

	$Results_as_array = get_object_vars( $Results );
	if( $Results_as_array['result_num_rows'] > 0 ) 
	{
		$File = & $FileCache->get_by_ID( $Results->rows[$file_number]->file_ID, false, false );
	}
	else
	{
		return false;
	}

	if( !is_object($File) && !$File->is_image() )
	{
		return false;
	}

	return $File;
}

?>

Then add this code to the skin in posts loop usually in index.main.php or posts.main.php

if( $File = & get_File_by_item_ID($Item->ID) )
{	// Display the first linked image
	// Use ( $Item->ID, 1 ) to display the second image
	// or ( $Item->ID, 5 ) to display the sixth image
	echo '<img src="'.$File->get_thumb_url().'" alt="" />';
}

3 Dec 02, 2008 21:44

Hi Sam,

Thanks again for the help.

I am using your Russian skin, 3 column at www.worldblogosphere.com . I don't see an actual "posts loop" in the index.main.php file. I actually tried putting withing the "Start Posts" area and all it did was show the coding at the top of the middle column. Any thoughts on where I should try it now?

Also, while I have your attention. It seems I have already managed to break the skin! Well, just a little. I moved the calendar from the left column to the right column. Right after I did that it seems the margin is off on the right edge. Any ideas on how I can correct that?

I have a couple other questions that I am going to put into their own posts later today. This way they are easier to find for others who might have the same question. I do have one more specifically for you though.

Is there a way to make all the posts listed on the home page appear the same size, or at least set the maximum height that should be shown?

Thank you again for any help you can offer.
Gene :-)

4 Dec 02, 2008 22:12

Find and edit the following code in index.main.php

if( $File = & get_File_by_item_ID($Item->ID) )
{   // Display the first linked image
    // Use ( $Item->ID, 1 ) to display the second image
    // or ( $Item->ID, 5 ) to display the sixth image
    echo '<img src="'.$File->get_thumb_url().'" alt="" />';
}
					
// ---------------------- POST CONTENT INCLUDED HERE ----------------------
	skin_include( '_item_content.inc.php', array(
			'image_size'	=>	'fit-400x320',
		) );
	// Note: You can customize the default item feedback by copying the generic
	// /skins/_item_content.inc.php file into the current skin folder.
// -------------------------- END OF POST CONTENT -------------------------

I moved the calendar from the left column to the right column. Right after I did that it seems the margin is off on the right edge.

I don't see any problem in FF3 and IE7, but you have [url=http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fworldblogosphere.com%2Findex.php]88 errors[/url] on the site you may want to fix.

Is there a way to make all the posts listed on the home page appear the same size, or at least set the maximum height that should be shown?

You should better use !M button on the post edit toolbar to split post content on two parts like in 2nd and 3rd posts.

Good luck

6 Dec 02, 2008 23:30

I created the file conf/hacks.php and it saved as confhacks.php

I also copied the code into the index.main.php file as you said.

I am now getting this error code -

Fatal error: Call to undefined function get_file_by_item_id() in /home/blogamer/public_html/skins/RU3/index.main.php on line 190 (Line 190 is the if line of the code)

After the first time I went and changed the name of the first file to just hacks.php still got the same error. then tried naming the file conf?hacks.php, thinking you might have just missed a shift key while typing the / . Still getting the error.

I don't see any problem in FF3 and IE7, but you have 88 errors on the site you may want to fix.

I am shocked that there are 88 errors. the only things I have messed around with are the plugins and such. As well as the top banner, and testing the Adsense code in one of the posts.

You should better use !M button on the post edit toolbar to split post content on two parts like in 2nd and 3rd posts.

Is there a way to put that ---more--- line into the post coding so it does it automatically when other users post?

Thanks again for all the help, and sorry to be a pain. lol

Gene :-)

7 Dec 03, 2008 02:18

Put the file hacks.php in directory /home/blogamer/public_html/conf/

Move the "User tools" widget to the sidebar to get rid of some errors.

The only way to insert <!-- more --> automatically is to force it after some number of characters or words, but it would break sentences and links.

8 Dec 06, 2008 10:37

Hi Sam,

When I put the hack.php file in the conf folder, and change the code in index.main.php like you said to it causes an error at the top of the page.

The error -
Warning: Cannot modify header information - headers already sent by (output started at /home/blogamer/public_html/conf/hacks.php:1) in /home/blogamer/public_html/skins_adm/_html_header.inc.php on line 40

Below is the _html_header.inc.php file segment with line 40 highlighted in red.

// ------------------------------ END OF REQUEST TITLE -----------------------------
?></title>
<meta name="description" content="<?php $Blog->disp( 'shortdesc', 'htmlattr' ); ?>" />
<meta name="keywords" content="<?php $Blog->disp( 'keywords', 'htmlattr' ); ?>" />
<?php robots_tag(); ?>
<meta name="generator" content="b2evolution <?php app_version(); ?>" /> <!-- Please leave this for stats -->
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php $Blog->disp( 'rss2_url', 'raw' ) ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom" href="<?php $Blog->disp( 'atom_url', 'raw' ) ?>" />
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="<?php echo $xmlsrv_url; ?>rsd.php?blog=<?php echo $Blog->ID; ?>" />
<link rel="stylesheet" href="style.css" type="text/css" />
<?php include_headlines() /* Add javascript and css files included by plugins and skin */ ?>
<?php
$Blog->disp( 'blog_css', 'raw');
$Blog->disp( 'user_css', 'raw');
?>
</head>
<body>
<?php

----------------------------

I now notice it is also causing an error in the Quick Upload window.

The error:

Warning: Cannot modify header information - headers already sent by (output started at /home/blogamer/public_html/conf/hacks.php:1) in /home/blogamer/public_html/plugins/quick_upload_plugin/upload_window.php on line 615

The segment from upload_window.php:

// ==========================================================
// Start output

header( 'Content-type: text/html; charset='.$io_charset );

echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="'.$current_User->locale.'" lang="'.$current_User->locale.'">
<head>

----------------------

It all seems to point to the header. Any thoughts on how I can remedy the situation?

I am leaving the files in place in case you need to see the error. www.worldblogosphere.com

Thanks again for being so very helpful,
Gene :-)

9 Dec 06, 2008 11:00

output started at /home/blogamer/public_html/conf/hacks.php:1

Check that you haven't got anything before the first <?php in your hacks file ;)

¥

10 Dec 06, 2008 11:10

Hi ¥,

It seems there was a blank space. I removed it, saved, and then checked.

On the home page I get this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/blogamer/public_html/conf/hacks.php:35) in /home/blogamer/public_html/inc/skins/_skin.funcs.php on line 383

If I click to edit the first post I get this eror at the top:

Warning: Cannot modify header information - headers already sent by (output started at /home/blogamer/public_html/conf/hacks.php:35) in /home/blogamer/public_html/skins_adm/_html_header.inc.php on line 40

Thanks for helping,
Gene :-)

11 Dec 06, 2008 11:15

output started at /home/blogamer/public_html/conf/hacks.php:35

I'd be checking for space at the end of the file as well ;)

¥

12 Dec 06, 2008 11:30

Thanks!

I am feeling very dumb, and also very grateful at the moment.

There was a space at the end. It is now gone, as is the error.

However, now that all the errors are gone it isn't creating any thumbnails.

Gene :-)

13 Dec 06, 2008 21:04

However, now that all the errors are gone it isn't creating any thumbnails.

Can you PM me your FTP login/pass and b2evo pass so I can take a look at it?


Form is loading...