[Mini FrontPage] Use "Intro image" as a thumbnail
- Posted by MisterV (8) Offline
Hi there,
Thank you for this great module. I noticed that it takes the first image within the article as a thumbnail. That's nice.
It would be great if the module also checked for an intro image or a full article image, to put it as a thumbnail. Any chance that gets implemented in the future ?
Note: i'm using Joomla 3 and I had to comment line 15 in mod_minifrontpage.php to make it work:
Or I would get this error:
You might want to check that.
12 years 1 month ago #1
by MisterV
Thank you for this great module. I noticed that it takes the first image within the article as a thumbnail. That's nice.
It would be great if the module also checked for an intro image or a full article image, to put it as a thumbnail. Any chance that gets implemented in the future ?
Note: i'm using Joomla 3 and I had to comment line 15 in mod_minifrontpage.php to make it work:
[14] //Create the temporary definition for DS
[15] define( 'DS', DIRECTORY_SEPARATOR ); <-- this one
Or I would get this error:
Notice: Constant DS already defined in C:\wamp\www\Joomla\modules\mod_minifrontpage\mod_minifrontpage.php on line 15
You might want to check that.
Please Log in or Create an account to join the conversation.
- Posted by andy (759) Offline
Hi MisterV,
Thank you for your feedback DS contant is something that has been removed in Joomla 3.0 but we still need this for some fix path purpose until we found a better replacement. Does Minifrontpage still working properly when you remove it?
12 years 1 month ago #2
by andy
Thank you for your feedback DS contant is something that has been removed in Joomla 3.0 but we still need this for some fix path purpose until we found a better replacement. Does Minifrontpage still working properly when you remove it?
Please Log in or Create an account to join the conversation.
- Posted by MisterV (8) Offline
- Posted by andy (759) Offline
hmmm strange, can you tell me other modules that you have installed in your website? It looks like the error coming from other module that is defining DS too, not from minifp
12 years 1 month ago #4
by andy
Please Log in or Create an account to join the conversation.
- Posted by MisterV (8) Offline
After checking, the DS function seems to be already defined in my template (MeetGavern). That's why it was redundant.
Anyway, any idea on the implementation of intro images as thumbnails ?
12 years 1 month ago #5
by MisterV
Anyway, any idea on the implementation of intro images as thumbnails ?
Please Log in or Create an account to join the conversation.
- Posted by MisterV (8) Offline
I figured how to do it, for those interested, here is how:
1°) Create a copy of the layout type you are using. For example, if you are using tabbed-no-effect, make a copy of this folder:
Copy content of:
/Joomla/modules/mod_minifrontpage/themes/tabbed-no-effect/
To new folder:
/Joomla/modules/mod_minifrontpage/themes/intro-img/
2°) Open
/intro-img/tmpl/bottom.php
FindAdd after
3°) Repeat operation 2°) for:
/intro-img/tmpl/lastcell.php
/intro-img/tmpl/lastcolumn.php
4°) Open
/intro-img/assets/css/style.css
Add at the end
However, don't use an intro image if there's already an image within the article, otherwise you'll get both. We would need something to override the thumbnail in case there's an intro image. But my knowledge of php is fairly limited. That is also why the code is not optimised.
12 years 1 month ago #6
by MisterV
1°) Create a copy of the layout type you are using. For example, if you are using tabbed-no-effect, make a copy of this folder:
Copy content of:
/Joomla/modules/mod_minifrontpage/themes/tabbed-no-effect/
To new folder:
/Joomla/modules/mod_minifrontpage/themes/intro-img/
2°) Open
/intro-img/tmpl/bottom.php
Find
if(!empty($item)){
// Intro image - start
$images = json_decode($item->images);
if (isset($images->image_intro) and !empty($images->image_intro)) {
echo '<div class="mfp-image-intro"><a href="';
echo JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid));
echo '"><img src="';
echo htmlspecialchars($images->image_intro);
echo '" alt="';
echo htmlspecialchars($images->image_intro_alt);
echo '"/></a></div>';
}
// Intro image - end
3°) Repeat operation 2°) for:
/intro-img/tmpl/lastcell.php
/intro-img/tmpl/lastcolumn.php
4°) Open
/intro-img/assets/css/style.css
Add at the end
.mfp-img-intro { /* This will make the intro image float on the left */
float: left;
width: 123px; /* Change the width to whatever you want */
padding: 0 10px 10px 0;
}
However, don't use an intro image if there's already an image within the article, otherwise you'll get both. We would need something to override the thumbnail in case there's an intro image. But my knowledge of php is fairly limited. That is also why the code is not optimised.
Please Log in or Create an account to join the conversation.