PDA

View Full Version : MoPics External Images



hrhstephen
07-29-2005, 12:15 PM
Hi, I have got mopics working with external images by modifying html_output.php tep_images function to display images from http locations. But it will not enlarge the pics, I presume it is because it cannot find them in the required folder. How do i fix this.?

N.b. It does enlarge other local pics. Any help on what else needs modifying will be greatly appreciated as this saves me a lot of space with my hosting company.

red_fraggle
07-30-2005, 12:20 AM
I would try editing the popup functions in the /includes/functions directory. These functions look for the popup image in an admin configurable directory. the directory it uses is based on the settings in admin for "dynamic mopics" > "large Image Folder", i think. This directory is normally, /images/images_big/ , you need to modify the popup funrtion to search for an external URL instead of a local folder for these images.

hrhstephen
07-30-2005, 04:04 AM
Thanks, that sounds a bit complicated.
Instead of searching is it possible to just enlarge the standard picture from the url which it already displays shrunk down. Here is popup_image.php:



require('includes/application_top.php');

// Include dynamic mopics functions
require(DIR_WS_FUNCTIONS . 'dynamic_mopics.php');

require(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . FILENAME_POPUP_IMAGE);

// Fix for search engine friendly urls with MS2
if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
if (isset($HTTP_GET_VARS)) $_GET =& $HTTP_GET_VARS;
}
$navigation->remove_current_page();

$products_query = tep_db_query("select pd.products_name, p.products_image from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and pd.language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($products_query);

// Set the large image's basename; replaces "imagebase" in the user's pattern
$image_base_lg = mopics_get_imagebase($product_info['products_image '], DIR_WS_IMAGES . DYNAMIC_MOPICS_BIGIMAGES_DIR);

// Validate the image type
$allowed_types = explode(',', str_replace(' ', '', DYNAMIC_MOPICS_BIG_IMAGE_TYPES));
if (!in_array($_GET['type'], $allowed_types)) {
die("Requested image was not found.");
}

if (isset($_GET['pic']) && tep_not_null($_GET['pic'])) {

// Get the current count
$i = $_GET['pic'];

// Set the search for the str_replace pattern search/replace
$search = array('imagebase', mopics_match_pattern(DYNAMIC_MOPICS_PATTERN));

// Set the replace for the str_replace pattern search/replace
$replace = array($image_base_lg, $i);

// Set the large image
$image = str_replace($search, $replace, DYNAMIC_MOPICS_PATTERN) . '.' . $_GET['type'];

} else {
$image = $image_base_lg . '.' . $_GET['type'];
}
$content = CONTENT_POPUP_IMAGE;
$javascript = $content . '.js';
$body_attributes = ' onload="resize();"';

require(DIR_WS_TEMPLATES . TEMPLATENAME_POPUP);

require('includes/application_bottom.php');