Can I order by name - minifrontpage

  • Posted by TemplatePlazza (5261) Offline

it appears blocky and much worse than the article intro image which is roughly the same size.

I see..

I'll consider to add settings for image quality for the next release. In the meantime you can open the helper file, arround lines 229 - 241 you will see the quality variables. try to increase 70 to 100
if($file_ext == 'png'){ 
					$imagetype = IMAGETYPE_PNG;
					$quality	= '7';
					$file_ext = 'png';
				}elseif($file_ext == 'gif'){ 
					$imagetype = IMAGETYPE_PNG;
					$quality	= '7';
					$file_ext = 'png';
				} else {
					$imagetype = IMAGETYPE_JPEG;
					$quality	= '70';
					$file_ext = 'jpg';
				}
4 years 10 months ago #7 by TemplatePlazza

Please Log in or Create an account to join the conversation.

I have tried the solution you suggested but it only gives a minor increase in quality. It seems the issue is the JImage quality itself (I think) or maybe the fact that the initial image is not that big.
Is there an option to configure the minifrontpage to just use the image as is without generating thumbnails?
Thanks
4 years 10 months ago #8 by ddd rrrr

Please Log in or Create an account to join the conversation.

  • Posted by TemplatePlazza (5261) Offline
I think it because the original file dimension is small and then JImage trying to create a bigger file. Try to change the thumbnail setting with your actual file size and then change the $size_multiplier in the helper file into 1.

Is there an option to configure the minifrontpage to just use the image as is without generating thumbnails?

You need to bypass the thumbnail creation process for that. Open the tmpl file with your php editor, for example, the template file for default theme : ../modules/mod_minifrontpage/tmpl/default.php

at lines 57 comment out or delete this code :
$thumb_img = MinifrontpageHelper::getThumbnail($item->id, $item->images,$thumb_folder,$show_default_thumb,$custom_default_thumb,$thumb_width,$thumb_height,$item->title,$item->introtext,$module->id);
change with this :
// Thumbnail is not exist
$images = json_decode($item->images);
// Find Article's Image
if (!empty($images->image_intro) ) {
$thumb_img = "<img src='".$images->image_intro."' />";
} elseif (empty($images->image_intro) && !empty($images->image_fulltext) ) {
$thumb_img = "<img src='".$images->image_fulltext."' />";
} else {
// Find first image in the article
$html = $item->introtext;
$html .= "alt='...' title='...' />";
$pattern = '/<img[^>]+src[\\s=\'"]';
    $pattern .= '+([^"\'>\\s]+)/is';
 
    if ( preg_match($pattern, $html, $match) ) {
    $thumb_img = "<img src='".$match[1]."' />";
    } else {
    $thumb_img = "";
    }
    }

then find all and replace this code (there are two existing)
$thumb_img[0];
change with
$thumb_img;
4 years 10 months ago #9 by TemplatePlazza

Please Log in or Create an account to join the conversation.

Thanks for the code, used it and now all is great :)
Would suggest to allow user to select if to generate thumbnails or not.
4 years 10 months ago #10 by ddd rrrr

Please Log in or Create an account to join the conversation.

  • Posted by TemplatePlazza (5261) Offline
Ok glad you've managed to solve it ;)
4 years 10 months ago #11 by TemplatePlazza

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum