- Posts: 2
- Thank you received: 0
Add thumbnail pics to the upcoming events module
- ebemoore
- Topic Author
- Offline
- New Member
Less
More
12 years 2 months ago #20286
by ebemoore
Add thumbnail pics to the upcoming events module was created by ebemoore
Hello,
Could you please tell me how to add a thumbnail pic to be displayed in the "upcoming events" module? Thank you so much for your help.
Ester
Could you please tell me how to add a thumbnail pic to be displayed in the "upcoming events" module? Thank you so much for your help.
Ester
Please Log in or Create an account to join the conversation.
- gabree
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
12 years 2 months ago - 12 years 2 months ago #20507
by gabree
Replied by gabree on topic Re: Add thumbnail pics to the upcoming events module
Hi, I have this wish as well.
I've read that the 1.4.5 version has the thumbnail feature,
but since I could not download it, and I have the 1.4 version, I have made this way.
I needed to put an image separated from the short description:
1) I modified the events and put an image in each event, in the short description, and save the events.
2) modify the code of the view template (ie location view, but could also be done in the upcoming events module)
my_site/components/com_eventbooking/views/location/tmpl/default.php
3) put the code to show the image where I wanted:
4) Optional, in the location or category template, search for the lines where "<?php echo $item->short_description ; ?>" is,
and replace with this code, in order to not repeat the image twice.
5) At last, resized the image with css, in order to make it appear as a thumbnail.
don't know if this could be useful to you,
I attach the image of the upcoming events module, with the title and the image thumbnail.
I've read that the 1.4.5 version has the thumbnail feature,
but since I could not download it, and I have the 1.4 version, I have made this way.
I needed to put an image separated from the short description:
1) I modified the events and put an image in each event, in the short description, and save the events.
2) modify the code of the view template (ie location view, but could also be done in the upcoming events module)
my_site/components/com_eventbooking/views/location/tmpl/default.php
3) put the code to show the image where I wanted:
Code:
<?php
//store short description
$str = $item->short_description;
//reg expression to match image
preg_match_all ('/<img[^>]+src\s*=\s*(["\'])?([^>\s]+)\1[^>]*>/i' , $str , $matches );
//set images to null
$event_img = null;
if (is_array($matches) && !empty($matches)) {
$event_img = $matches[2][0];
}
//check if image exist
if (($event_img != null) && (strlen($event_img)>0)) {
$image_name = $event_img;
} else {
//if image does not exist, put a placeholder
$image_name = "/images/img_default.jpg";
}
//display image (or placeholder)
?>
<p><a href="<?php echo $url; ?>"><img src="<?php echo $image_name; ?>" alt="" /></a></p>
4) Optional, in the location or category template, search for the lines where "<?php echo $item->short_description ; ?>" is,
and replace with this code, in order to not repeat the image twice.
Code:
<?php
//strip tags (except paragraph, anchor, etc.) from short description so that image does not show up
$new_str = strip_tags($item->short_description, '<p><a><br><div><strong><em>');
//display short description limiting to 110 characters
echo $new_str;
endif;
?>
5) At last, resized the image with css, in order to make it appear as a thumbnail.
don't know if this could be useful to you,
I attach the image of the upcoming events module, with the title and the image thumbnail.
Last edit: 12 years 2 months ago by gabree. Reason: wrong answer
Please Log in or Create an account to join the conversation.
- gabree
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
12 years 2 months ago #20684
by gabree
Replied by gabree on topic Re: Add thumbnail pics to the upcoming events module
I've posted the solution for a previous release,
now I'm posting the solution for 1.5 version.
1) open the main module file:
modules/mod_eb_events/mod_eb_events.php
on line 34 modify the query adding the thumb, this way:
change from this
to this
save and close the file.
2) open the template file:
modules/mod_eb_events/tmpl/default.php
put the thumbnail code anywhere you like it
that's all, attached is an example.
now I'm posting the solution for 1.5 version.
1) open the main module file:
modules/mod_eb_events/mod_eb_events.php
on line 34 modify the query adding the thumb, this way:
change from this
Code:
$sql = 'SELECT a.id, a.title, a.location_id, a.event_date, c.name AS location_name FROM #__eb_events AS a '
to this
Code:
$sql = 'SELECT a.id, a.title, a.location_id, a.event_date, a.thumb, c.name AS location_name FROM #__eb_events AS a '
save and close the file.
2) open the template file:
modules/mod_eb_events/tmpl/default.php
put the thumbnail code anywhere you like it
Code:
<?php
if ($row->thumb && file_exists(JPATH_ROOT.'/media/com_eventbooking/images/thumbs/'.$row->thumb)) {
?>
<a href="<?php echo JRoute::_('index.php?option=com_eventbooking&task=view_event&event_id='.$row->id); ?>&Itemid=<?php echo $itemId; ?>"><img src="<?php echo JURI::base().'media/com_eventbooking/images/thumbs/'.$row->thumb; ?>" /></a>
<?php
}
?>
that's all, attached is an example.
Please Log in or Create an account to join the conversation.
Moderators: Tuan Pham Ngoc
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.