| Hi, Currently the way this module is set up, it only displays an image, if it was put using mosimage (meaning that the image has to be uploaded onto the server). I want to be able to have it display an image that is from a different server (placed into the post using the add image function) what would I add/change in the following code to enable this. (I think I copied off all the relevant code). Thanks Code: function replaceImage( &$row, $maxchars, $showimage, $width = -1, $height = -1 ) { global $database, $_MAMBOTS, $current_charset; // expression to search for $regex = '/{mosimage\s*.*?}/i'; $image = $showimage?processImage ( $row, $width, $height ):""; $row->introtext = trim($row->introtext); $row->introtext = preg_replace( $regex, '', $row->introtext ); $row->introtext1 = strip_tags($row->introtext); if ($maxchars && strlen ($row->introtext) > $maxchars) { $row->introtext1 = substr ($row->introtext1, 0, $maxchars) . "..."; } // clean up globals return $image; } function processImage ( &$row, $width, $height ) { global $mosConfig_absolute_path, $mosConfig_live_site; // split on \n the images fields into an array $row->images = explode( "\n", $row->images ); $img = trim( $row->images[0] ); // split on pipe the attributes of the image if ( $img ) { $attrib = explode( '|', trim( $img ) ); // $attrib[0] image name and path from /images/stories // $attrib[1] alignment if ( !isset($attrib[1]) || !$attrib[1] ) { $attrib[1] = ''; } // $attrib[2] alt & title if ( !isset($attrib[2]) || !$attrib[2] ) { $attrib[2] = 'Image'; } else { $attrib[2] = htmlspecialchars( $attrib[2] ); } // $attrib[3] border if ( !isset($attrib[3]) || !$attrib[3] ) { $attrib[3] = 0; } $attrib[4] = ''; $border = 0; // $attrib[5] caption position if ( !isset($attrib[5]) || !$attrib[5] ) { $attrib[5] = ''; } // $attrib[6] caption alignment if ( !isset($attrib[6]) || !$attrib[6] ) { $attrib[6] = ''; } // image size attibutes // assemble the <image> tag $image = '<img src="'. $mosConfig_live_site .'/images/stories/'. $attrib[0] .'"'; // no aligment variable - if caption detected if ( !$attrib[4] ) { $image .= $attrib[1] ? ' align="'. $attrib[1] .'"' : ''; } $image .=' alt="'. $attrib[2] .'" title="'. $attrib[2] .'" border="'. $border .'" '. (($width != -1) ? 'width="'. $width . '"' : '') .(($height != -1) ? ' height="'. $height .'"' : '').' />'; $img = $image; } return $img; |
Forum 





Author



Logged





