-
AuthorPosts
-
October 7, 2011 at 1:54 pm #169422
JA Contentslider show image only on home page !
but in other page the plygine can’t show imagethe link of image is corrupted
http://www.mysite.com/82-demo/top-rated-hotels-in-france/images/resized/images/stories/demo/sam-3_150_90.jpg
JA Contentslider work fine on home because he use the right link
http://www.mysite.com/images/resized/images/stories/demo/sam-3_150_90.how to resolve this
chavan Friendchavan
- Join date:
- October 2014
- Posts:
- 4612
- Downloads:
- 0
- Uploads:
- 110
- Thanked:
- 1440 times in 1290 posts
October 7, 2011 at 6:11 pm #417591Need your site Url
October 7, 2011 at 6:47 pm #417601the same problem trip-top.ru
chavan Friendchavan
- Join date:
- October 2014
- Posts:
- 4612
- Downloads:
- 0
- Uploads:
- 110
- Thanked:
- 1440 times in 1290 posts
October 7, 2011 at 6:56 pm #417605which Url you see the screenshot.
October 7, 2011 at 10:34 pm #417629here is
the thumb work on home page
http://www.mysite.com/trav5/
but not work on other page
http://mysite.com/trav5/82-demo/top-rated-hotels-in-france/81-dubai-emirat-arab-unis.htmlchavan Friendchavan
- Join date:
- October 2014
- Posts:
- 4612
- Downloads:
- 0
- Uploads:
- 110
- Thanked:
- 1440 times in 1290 posts
October 8, 2011 at 4:34 am #417670Please post your ftp details in PM. I will fix it.
chavan Friendchavan
- Join date:
- October 2014
- Posts:
- 4612
- Downloads:
- 0
- Uploads:
- 110
- Thanked:
- 1440 times in 1290 posts
October 9, 2011 at 5:20 am #417832what did you do? I have the same problem, and i switch if off on all pages.
October 9, 2011 at 11:56 am #417929Thanks @chavan
@saesaeru i have use winmerge to detect what he change to resolve the problem
because the Chinese pepole says “Don’t give me the fish but teach me to fish!”
He add 3 line on fileline 504 [PHP]$imageURL = JURI::base().$imageURL;[/PHP] After [PHP]$height = $height ? “height=”$height”” : “”;[/PHP]
line 508[PHP] $image = JURI::base().$image;[/PHP] After [PHP] $image = “<img src=”$imageURL” alt=”{$title}” title=”{$title}” $width $height $attrs />”;} else {[/PHP]
line 524 [PHP]$image = JURI::base().$image;[/PHP] After [PHP]$height = $height ? “height=”$height”” : “”;[/PHP]The entrie code from 503 to 529
[PHP] $height = $height ? “height=”$height”” : “”;
$imageURL = JURI::base().$imageURL;
$image = “<img src=”$imageURL” alt=”{$title}” title=”{$title}” $width $height $attrs />”;} else {
$image = JURI::base().$image;
$image = “<img $attrs src=”$image” $attrs alt=”{$title}” title=”{$title}” />”;}
} else {
if( $returnURL ){
return $image;
}
$width = $width ? “width=”$width”” : “”;
$height = $height ? “height=”$height”” : “”;
$image = JURI::base().$image;
$image = “<img $attrs src=”$image” alt=”{$title}” title=”{$title}” $width $height />”;} [/PHP]
chavan Friendchavan
- Join date:
- October 2014
- Posts:
- 4612
- Downloads:
- 0
- Uploads:
- 110
- Thanked:
- 1440 times in 1290 posts
October 9, 2011 at 3:20 pm #417974saesaeru,
Do what xsav2 said in his previous post. That is what exactly what i have fixed for him.
If not let me know I will attach that helper.php file.
Note: If you Find my Post useful please click on the Thanks Icon
October 10, 2011 at 6:13 am #418124The best way if the JA team put it in JA repository. And everybody update it from Extention manager.
Anyway please give me helper.php please 🙂chavan Friendchavan
- Join date:
- October 2014
- Posts:
- 4612
- Downloads:
- 0
- Uploads:
- 110
- Thanked:
- 1440 times in 1290 posts
October 10, 2011 at 6:22 am #418126Here is the whole PHP code of helper.php
<?php/**
* ------------------------------------------------------------------------
* JA Contenslider module for Joomla 1.7
* ------------------------------------------------------------------------
* Copyright (C) 2004-2011 JoomlArt.com. All Rights Reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* Author: JoomlArt.com
* Websites: http://www.joomlart.com - http://www.joomlancers.com.
* ------------------------------------------------------------------------
*/
// no direct access
defined('_JEXEC') or die;
require_once JPATH_SITE.'/components/com_content/helpers/route.php';
JModel::addIncludePath(JPATH_SITE.'/components/com_content/models');
class modJacontentsliderHelper {
/**
* get instance of modJacontentsliderHelper
*/
function getInstance(){
static $__instance = null;
if( !$__instance ){
$__instance = new modJacontentsliderHelper();
}
return $__instance;
}
/**
* get Total contents by category.
*
* @params object.
*/
function getTotalContents( $catid=0 ){
// Get the dbo
$db = JFactory::getDbo();
// Get an instance of the generic articles model
$model = JModel::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
// Set application parameters in model
$appParams = JFactory::getApplication()->getParams();
$model->setState('params', $appParams);
$model->setState(
'list.select',
'a.id, a.title, a.alias, a.title_alias, a.introtext, ' .
'a.checked_out, a.checked_out_time, ' .
'a.catid, a.created, a.created_by, a.created_by_alias, ' .
// use created if modified is 0
'CASE WHEN a.modified = 0 THEN a.created ELSE a.modified END as modified, ' .
'a.modified_by,' .
// use created if publish_up is 0
'CASE WHEN a.publish_up = 0 THEN a.created ELSE a.publish_up END as publish_up, ' .
'a.publish_down, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, '.
'a.hits, a.xreference, a.featured,'.' LENGTH(a.fulltext) AS readmore '
);
$model->setState('filter.published', 1);
// Access filter
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
$model->setState('filter.access', $access);
// Category filter
if($catid){
if($catid[0]!=""){
$model->setState('filter.category_id', $catid);
}
}
$items = $model->getItems();
return count($items);
}
function articleLink($item) {
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
$item->slug = $item->id.':'.$item->alias;
$item->catslug = $item->catid.':'.$item->category_alias;
if ($access || in_array($item->access, $authorised))
{
// We know that user has the privilege to view the article
$item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug));
}
else {
$item->link = JRoute::_('index.php?option=com_user&view=login');
}
return $item->link;
}
function getListItems( $catid, $params, $source='content'){
$helper = new modJacontentsliderHelper();
if($source == 'folder') {
return $helper->getListFolder($params);
} else {
$callMethod = 'getList'.ucfirst($source);
if( method_exists($helper, $callMethod) ){
return $helper->$callMethod($catid, $params );
}
}
return array();
}
function getListContent( $catid, $params ){
$mainframe = JFactory::getApplication();
// Get the dbo
$db = JFactory::getDbo();
// Get an instance of the generic articles model
$model = JModel::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
/* cc.description as catdesc, cc.title as cattitle */
// Set application parameters in model
$appParams = JFactory::getApplication()->getParams();
$model->setState('params', $appParams);
$model->setState(
'list.select',
'a.id, a.title, a.alias, a.title_alias, a.introtext, ' .
'a.checked_out, a.checked_out_time, ' .
'a.catid, a.created, a.created_by, a.created_by_alias, ' .
// use created if modified is 0
'CASE WHEN a.modified = 0 THEN a.created ELSE a.modified END as modified, ' .
'a.modified_by,' .
// use created if publish_up is 0
'CASE WHEN a.publish_up = 0 THEN a.created ELSE a.publish_up END as publish_up, ' .
'a.publish_down, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, '.
'a.hits, a.xreference, a.featured,'.' LENGTH(a.fulltext) AS readmore '
);
// Set the filters based on the module params
$model->setState('list.start', 0);
//if($limit>0) {
$model->setState('list.limit', $params->get('maxitems', 10));
//}
$model->setState('filter.published', 1);
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
$model->setState('filter.access', $access);
// Category filter
if($catid){
if($catid[0]!=""){
$model->setState('filter.category_id', $catid);
}
}
if($params->get('sort_order_field', 'created') =="ordering"){
$model->setState('list.ordering', 'a.ordering');
}else{
$model->setState('list.ordering', $params->get('sort_order_field', 'created'));
}
$model->setState('list.direction', $params->get('sort_order', 'DESC'));
$data = $model->getItems();
$thumbnailMode = $params->get( 'source-articles-images-thumbnail_mode', 'crop' );
$aspect = $params->get( 'source-articles-images-thumbnail_mode-resize-use_ratio', '1' );
$crop = $thumbnailMode == 'crop' ? true:false;
$jaimage = JAImage::getInstance();
foreach( $data as $i => $row ) {
$data[$i]->text = $data[$i]->introtext;
$mainframe->triggerEvent( 'onPrepareContent', array( &$data[$i], &$params, 0 ) , true );
$data[$i]->introtext = $data[$i]->text;
$data[$i]->catid = $row->catid;
$data[$i]->title = $row->title;
$data[$i]->cateName = $row->category_title;
$data[$i]->link = modJacontentsliderHelper::articleLink($row);
$image = modJacontentsliderHelper::parseImages( $data[$i], $params );
if( $image ) {
$data[$i]->image = modJacontentsliderHelper::renderImage( $row->title, $data[$i]->link, $image, $params, $params->get( 'iwidth' ), $params->get( 'iheight' ) ) ;
}
else {
$data[$i]->image = '';
}
}
return $data;
}
function getListFolder($params) {
$folder = $params->get('folder_images');
$path = JPath::clean(JPATH_ROOT.DS.$folder);
$data = array();
if(JFolder::exists($path)) {
$files = JFolder::files($path, ".(jpg|png|gif|jpeg|bmp)$");
$i = 0;
foreach ($files as $file) {
$image = JURI::root().JPath::clean($folder.'/'.$file, '/');
$item = new stdClass();
$item->text = '';
$item->introtext = $item->text;
$item->catid = 1;
$item->title = $file;
$item->cateName = '';//JText::_('Images');
$item->link = $image;
$item->image = modJacontentsliderHelper::renderImage( $item->title, $item->link, $image, $params, $params->get( 'iwidth' ), $params->get( 'iheight' ) ) ;
$data[$i] = $item;
$i++;
}
}
return $data;
}
/**
* parser a image in the content of article.
*/
function parseImages( &$row, $params ){
$text = $row->introtext.$row->text;
$regex = "/<img.+?srcs*=s*["|']([^"]*)["|'][^>]*>/";
preg_match ($regex, $text, $matches);
$images = (count($matches)) ? $matches : array();
if (count($images)){
return $images[1];
}
return ;
}
function renderImage( $title, $link, $image, $params, $width = 0, $height = 0, $attrs='', $returnURL=false ) {
global $database, $_MAMBOTS, $current_charset;
if ( $image ) {
$title = strip_tags( $title );
$thumbnailMode = $params->get( 'source-articles-images-thumbnail_mode', 'crop' );
$aspect = $params->get( 'source-articles-images-thumbnail_mode-resize-use_ratio', '1' );
$crop = $thumbnailMode == 'crop' ? true:false;
$jaimage = JAImage::getInstance();
if( $thumbnailMode != 'none' && $jaimage->sourceExited($image) ) {
$imageURL = $jaimage->resize( $image, $width, $height, $crop, $aspect );
if( $returnURL ){
return $imageURL;
}
if ( $imageURL != $image && $imageURL ) {
$width = $width ? "width="$width"" : "";
$height = $height ? "height="$height"" : "";
$imageURL = JURI::base().$imageURL;
$image = "<img src="$imageURL" alt="{$title}" title="{$title}" $width $height $attrs />";} else {
$image = JURI::base().$image;
$image = "<img $attrs src="$image" $attrs alt="{$title}" title="{$title}" />";}
} else {
if( $returnURL ){
return $image;
}
$width = $width ? "width="$width"" : "";
$height = $height ? "height="$height"" : "";
$image = JURI::base().$image;
$image = "<img $attrs src="$image" alt="{$title}" title="{$title}" $width $height />";}
} else {
$image = '';
}
$image = '<a href="'.$link.'" title="" class="ja-image">'.$image.'</a>';
// clean up globals
return $image;
}
/**
*
*
*/
function replaceImage( &$row, $maxchars, $showimage, $width = 0, $height = 0 ) {
// expression to search for
$row->introtext1 = strip_tags($row->introtext);
if ($maxchars && strlen ($row->introtext) > $maxchars) {
$row->introtext1 = substr ($row->introtext1, 0, $maxchars) . "...";
}
// clean up globals
return $row->image;
}
/**
*
*/
function processImage ( &$row, $width, $height ) {
/* for 1.5 - don't need to use image parameter */
return 0;
/* End 1.5 */
}
/**
* load javascript files: processing override js, load js compress or not.
*/
function javascript( $params ){
$document =& JFactory::getDocument();
$document->addScript( JURI::base().'modules/mod_jacontentslider/assets/js/ja_contentslider.js' );
}
/**
* load css files: processing override css
*/
function css( $params ){
$mainframe = JFactory::getApplication();
$document =& JFactory::getDocument();
$cssFile = 'mod_jacontentslider.css';
if( file_exists(JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'css'.DS.$cssFile) ) {
$document->addStyleSheet( JURI::base().'templates/'.$mainframe->getTemplate().'/css/'.$cssFile );
} else {
$document->addStyleSheet( JURI::base().'modules/mod_jacontentslider/assets/css/style.css' );
}
}
/**
* check overrider layout.
*/
function getLayoutPath($module, $layout = 'default') {
$mainframe = JFactory::getApplication();
// Build the template and base path for the layout
$tPath = JPATH_BASE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.$module.DS.$layout.'.php';
$bPath = JPATH_BASE.DS.'modules'.DS.$module.DS.'tmpl'.DS.$layout.'.php';
// If the template has a layout override use it
if (file_exists($tPath)) {
return $tPath;
} else {
return $bPath;
}
}
}
?>
Note: If you Find my Post useful please click on the Thanks Icon
1 user says Thank You to chavan for this useful post
wertz Friendwertz
- Join date:
- March 2011
- Posts:
- 40
- Downloads:
- 0
- Uploads:
- 13
- Thanks:
- 11
- Thanked:
- 1 times in 1 posts
November 18, 2011 at 3:50 pm #425275thank you for this informations!
AuthorPostsViewing 13 posts - 1 through 13 (of 13 total)This topic contains 13 replies, has 4 voices, and was last updated by wertz 13 years, 1 month ago.
We moved to new unified forum. Please post all new support queries in our New Forum
JA Contentslider show image only on home page !
Viewing 13 posts - 1 through 13 (of 13 total)