';
}
if ($action == 'ih_scan_originals') {
if (count($import_info) > 0) {
echo zen_draw_form('import_form', FILENAME_IMAGE_HANDLER, '', 'get');
echo zen_draw_hidden_field('action', 'ih_import_images');
echo IH_CONFIRM_IMPORT . '
';
echo zen_image_submit('button_confirm.gif', IMAGE_CONFIRM) . '
';
for ($i = 0; $i < count($import_info); $i++) {
echo "#$i: " . $import_info[$i]['original'] . ' => ' . $import_info[$i]['target'] . '
';
}
echo '
' . IH_CONFIRM_IMPORT . '
';
echo zen_image_submit('button_confirm.gif', IMAGE_CONFIRM) . '
';
echo '';
}
}
if (count($ih_admin_actions) > 0) {
echo '
';
foreach ($ih_admin_actions as $action_name => $link_name) {
echo '- ' . $link_name . '
';
}
echo '
';
}
/**
* MANAGER TABPAGE
*/
if ($page == 'manager') {
$curr_page = FILENAME_IMAGE_HANDLER;
require(DIR_WS_MODULES . FILENAME_PREV_NEXT_DISPLAY);
?>
|
|
' . TEXT_PRICED_BY_ATTRIBUTES . '' . ' ' : '');
echo zen_get_products_display_price($_GET['products_filter']) . '
';
echo zen_get_products_quantity_min_units_display($_GET['products_filter'], $include_break = true);
$not_for_cart = $db->Execute("select p.products_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCT_TYPES . " pt on p.products_type= pt.type_id where pt.allow_add_to_cart = 'N'");
} else {
echo '';
$not_for_cart = new stdClass();
$not_for_cart->fields = array();
}
?>
|
fields, true, $_GET['products_filter'], true, true); ?> |
|
|
Execute("select p.products_id, p.products_model,
p.products_image,
p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.products_priced_by_attribute, p.products_status,
p.products_discount_type, p.products_discount_type_from, p.products_price_sorter,
pd.products_name,
p.master_categories_id
from " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = '" . $_GET['products_filter'] . "'
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
if ($product->RecordCount() > 0) {
$pInfo = new objectInfo($product->fields);
}
// Determine if there are any images and work out the file names
// (based on code from modules/pages/product_info/main_template_vars_images(& _additional) (copying is evil!))
if ($pInfo->products_image != '') {
$products_image = $pInfo->products_image;
$products_image_match_array = array();
// get file extension and base
$products_image_extension = substr($products_image, strrpos($products_image, '.'));
$products_image_base = preg_replace("/".$products_image_extension."$/", '', $products_image);
// if in a subdirectory
if (strrpos($products_image_base, '/')) {
$products_image_base = substr($products_image_base, strrpos($products_image_base, '/')+1);
}
// sort out directory
$products_image_directory = substr($products_image, 0, strrpos($products_image, '/'));
// add slash to base dir
if (($products_image_directory != '') && (!preg_match("|\/$|", $products_image_directory))) {
$products_image_directory .= '/';
}
$products_image_directory_full = DIR_FS_CATALOG . DIR_WS_IMAGES . $products_image_directory;
// Check that the image exists! (out of date Database)
if (file_exists( $products_image_directory_full . $products_image_base . $products_image_extension )) {
// Add base image to array
$products_image_match_array[] = $products_image_base . $products_image_extension;
// $products_image_base .= "_";
// Check for additional matching images
find_additional_images($products_image_match_array, $products_image_directory_full,
$products_image_extension, $products_image_base );
}
} // if products_image
?>
products_id != '') {
?>
products_id . ' ' . $pInfo->products_name; ?>
products_model != '') {
echo TEXT_PRODUCTS_MODEL . ': ' . $pInfo->products_model;
}
?>
products_image != '') {
if (preg_match("/^([^\/]+)\//", $pInfo->products_image, $matches)) {
echo TEXT_IMAGE_BASE_DIR .': ';
echo $matches[1];
}
}
?>
|
|
|
|
|
|
|
get_local();
$tmp_image_file_full = DIR_FS_CATALOG . $tmp_image_file;
$tmp_image_preview = new ih_image($tmp_image_file, IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT);
$tmp_image_medium = new ih_image($image_file_medium, $ihConf['medium']['width'], $ihConf['medium']['height']);
$tmp_image_file_medium = $tmp_image_medium->get_local();
$tmp_image_file_medium_full = DIR_FS_CATALOG . $tmp_image_file_medium;
$tmp_image_medium_preview = new ih_image($tmp_image_file_medium, IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT);
$tmp_image_large = new ih_image($image_file_large, $ihConf['large']['width'], $ihConf['large']['height']);
$tmp_image_file_large = $tmp_image_large->get_local();
$tmp_image_file_large_full = DIR_FS_CATALOG . $tmp_image_file_large;
$tmp_image_large_preview = new ih_image($tmp_image_file_large, IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT);
// Get file details
$text_default_size = get_image_details_string( $tmp_image_file_full );
$text_medium_size = get_image_details_string( $tmp_image_file_medium_full );
$text_large_size = get_image_details_string( $tmp_image_file_large_full );
if ($first == 1) {
$tmp_image_link = zen_catalog_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $pInfo->products_id);
$first = 0;
} else {
$tmp_image_link = zen_catalog_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL,
'pID=' . $pInfo->products_id . '&pic='.($i).'&products_image_large_additional='.$tmp_image_file_large);
}
if ( isset($_GET['imgName']) && $_GET['imgName'] == $tmp_image_name ) {
// an image is selected, highlight it
echo '' . "\n";
// set some details for later usage
$selected_image_file = DIR_WS_CATALOG . $tmp_image_file_medium;
$selected_image_file_large = DIR_WS_CATALOG . $tmp_image_file_large;
$selected_image_link = $tmp_image_link;
$selected_image_name = $tmp_image_name;
$selected_image_suffix = preg_replace("/^".$products_image_base."/", '', $tmp_image_name);
$selected_image_extension = $products_image_extension;
} else {
echo ' ' . "\n";
}
?>
|
> |
get_resized_image(IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT, 'generic');
list($width, $height) = @getimagesize(DIR_FS_CATALOG . $preview_image);
$width = min($width, intval(IMAGE_SHOPPING_CART_WIDTH));
$height = min ($height, intval(IMAGE_SHOPPING_CART_HEIGHT));
echo zen_image(DIR_WS_CATALOG . $preview_image, addslashes($pInfo->products_name), $width, $height) . ' ';
?>
|
get_resized_image(IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT, 'generic');
list($width, $height) = @getimagesize(DIR_FS_CATALOG . $preview_image);
$width = min($width, intval(IMAGE_SHOPPING_CART_WIDTH));
$height = min ($height, intval(IMAGE_SHOPPING_CART_HEIGHT));
echo zen_image(DIR_WS_CATALOG . $preview_image, addslashes($pInfo->products_name), $width, $height) . ' ';
echo $text_medium_size . ' ';
if (is_file($image_file_medium_full)) {
echo ' '
. zen_image_button('button_delete.gif', IMAGE_DELETE) . '';
}
?>
|
get_resized_image(IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT, 'generic');
list($width, $height) = @getimagesize(DIR_FS_CATALOG . $preview_image);
$width = min($width, intval(IMAGE_SHOPPING_CART_WIDTH));
$height = min ($height, intval(IMAGE_SHOPPING_CART_HEIGHT));
echo zen_image(DIR_WS_CATALOG . $preview_image, addslashes($pInfo->products_name), $width, $height) . ' ';
echo $text_large_size . ' ';
if (is_file($image_file_large_full)) {
echo ' '
. zen_image_button('button_delete.gif', IMAGE_DELETE) . '';
}
?>
|
' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '';
}
?> |
|
'' . TEXT_INFO_IMAGE_INFO . '');
$contents = array('align' => 'center', 'form' => zen_draw_form('image_define', FILENAME_IMAGE_HANDLER,
'page=' . $_GET['page'] . '&products_filter=' . $_GET['products_filter'] . '&action=save', 'post', 'enctype="multipart/form-data"'));
$contents[] = array('text' => ''.TEXT_INFO_NAME.': ' . $selected_image_name .'
');
$contents[] = array('text' => ''.TEXT_INFO_FILE_TYPE.': ' . $selected_image_extension .'
');
$contents[] = array('text' =>
'
' );
// show new, delete, and edit buttons
$contents[] = array('align' => 'center', 'text' => '
' .
' '
. zen_image_button('button_edit.gif', IH_IMAGE_EDIT) . ' '
.' '
. zen_image_button('button_delete.gif', IMAGE_DELETE) . ' '
.' '
. zen_image_button('button_new_file.gif', IH_IMAGE_NEW_FILE) . '');
break;
case 'layout_edit':
// Edit specific details
$imgNameStr = '&imgEdit=1' .'&imgBase=' . $products_image_base
. "&imgSuffix=" . $selected_image_suffix
. "&imgBaseDir=" . $products_image_directory
. "&imgExtension=" . $selected_image_extension;
$heading[] = array('text' => '' . TEXT_INFO_EDIT_PHOTO . '');
case 'layout_new':
/* if ( $action != 'layout_edit' ) {
$imgNameStr .= ( $no_images ) ? "&newImg=1" : '&imgBase='.$products_image_base
. "&imgBaseDir=" . $products_image_directory
. "&imgExtension=" . $products_image_extension;
$heading[] = array('text' => '' . TEXT_INFO_NEW_PHOTO . '');
}
*/
if ( $action != 'layout_edit' ) {
$imgNameStr .= ( $no_images ) ? "&newImg=1" : '&imgBase='.$products_image_base
. "&imgBaseDir=" . $products_image_directory
. "&imgExtension=" . $default_extension;
$heading[] = array('text' => '' . TEXT_INFO_NEW_PHOTO . '');
}
$contents = array('form' => zen_draw_form('image_define', FILENAME_IMAGE_HANDLER,
'&products_filter=' . $_GET['products_filter'] . $imgNameStr
.'&action=save', 'post', 'enctype="multipart/form-data"'));
// check if this is a master image or if no images exist
if ($no_images) {
$contents[] = array('text' => ''.TEXT_INFO_IMAGE_BASE_NAME.'
' );
$contents[] = array('text' => zen_draw_input_field('imgBase', '', 30));
$dir = @dir(DIR_FS_CATALOG_IMAGES);
$dir_info[] = array('id' => '', 'text' => TEXT_INFO_MAIN_DIR);
while ($file = $dir->read()) {
if (is_dir(DIR_FS_CATALOG_IMAGES . $file)
&& strtoupper($file) != 'CVS'
&& $file != "."
&& $file != ".."
&& $file != 'original'
&& $file != 'medium'
&& $file != 'large') {
$dir_info[] = array('id' => $file . '/', 'text' => $file);
}
}
$contents[] = array('text' => '
'.TEXT_INFO_BASE_DIR.'
'.TEXT_INFO_NEW_DIR);
$contents[] = array('text' => TEXT_INFO_IMAGE_DIR . zen_draw_pull_down_menu('imgBaseDir', $dir_info, ""));
$contents[] = array('text' => TEXT_INFO_OR.' ' . zen_draw_input_field('imgNewBaseDir', '', 20) );
} else if ($action != 'layout_edit') {
$contents[] = array('text' => ''.TEXT_INFO_IMAGE_SUFFIX.'
'.TEXT_INFO_USE_AUTO_SUFFIX.'
' );
$contents[] = array('text' => zen_draw_input_field('imgSuffix', $selected_image_suffix, 10) );
}
// Image fields
// Nigels ugly hack to display warning on edit screen that the default file must be filled in
if ( $action == 'layout_new' ) {// -this section is the hack
//-------------------------
$contents[] = array('text' => '
' . TEXT_INFO_DEFAULT_IMAGE . ' (required)
'
. TEXT_INFO_DEFAULT_IMAGE_HELP . '
'
. zen_draw_input_field('default_image', '', ' size="20" ', false, 'file') . '
' . $pInfo->products_image);
} else { // this section is the original code
$contents[] = array('text' => '
' . TEXT_INFO_DEFAULT_IMAGE . '
'
. TEXT_INFO_DEFAULT_IMAGE_HELP . '
'
. zen_draw_input_field('default_image', '', ' size="20" ', false, 'file') . '
' . $pInfo->products_image);
}
if ( $action == 'layout_edit' ) {
if ( $selected_image_name == $products_image_match_array[0]) {
$contents[] = array('text' => zen_draw_radio_field('imgNaming', 'new_discard', true)
. IH_NEW_NAME_DISCARD_IMAGES . '
'
// new_copy functionality scheduled for future release
// . zen_draw_radio_field('imgNaming', 'new_copy', false)
// . IH_NEW_NAME_COPY_IMAGES . '
'
. zen_draw_radio_field('imgNaming', 'keep_name', false)
. IH_KEEP_NAME);
}
}
$contents[] = array('text' => '
' . TEXT_MEDIUM_FILE_IMAGE . '
' .
zen_draw_input_field('medium_image', '', ' size="20" ', false, 'file') . '
');
$contents[] = array('text' => '
' . TEXT_LARGE_FILE_IMAGE . '
' .
zen_draw_input_field('large_image', '', ' size="20" ', false, 'file') . '
');
$contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_save.gif', IMAGE_SAVE) );
break;
case 'layout_delete':
$imgStr = "&imgBase=" . $products_image_base
. "&imgSuffix=" . $selected_image_suffix
. "&imgBaseDir=" . $products_image_directory
. "&imgExtension=" . $selected_image_extension;
// show new button
$heading[] = array('text' => '' . TEXT_INFO_CONFIRM_DELETE . '');
$contents[] = array('text' => '
' . $products_image_directory.$products_image_base.$selected_image_suffix.$selected_image_extension);
$contents[] = array('text' => '
' . TEXT_INFO_CONFIRM_DELETE_SURE);
if ($selected_image_suffix == '') {
$contents[] = array('text' => zen_draw_checkbox_field('delete_from_database_only', 'Y', false) . IH_DELETE_FROM_DB_ONLY);
}
$contents[] = array('align' => 'center', 'text' => '
'
.' '
. zen_image_button( 'button_delete.gif', IMAGE_DELETE ) . '');
break;
default:
// show new button
$heading[] = array('text' => '' . TEXT_INFO_SELECT_ACTION . '');
$contents = array('form' => zen_draw_form('image_define', FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&action=new', 'post', 'enctype="multipart/form-data"'));
$contents[] = array('text' => '
' . TEXT_INFO_CLICK_TO_ADD);
$contents[] = array('align' => 'center', 'text' => '
'
.' '
. zen_image_button('button_new_file.gif', IH_IMAGE_NEW_FILE) . '');
break;
}
if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
echo ' ' . "\n";
$box = new box;
echo $box->infoBox($heading, $contents);
echo ' | ' . "\n";
}
?>
get_resized_image(intval($ihConf['small']['width']), intval($ihConf['small']['height']), 'orig');
$images['pngsmall'] = $pngimage->get_resized_image($ihConf['small']['width'], $ihConf['small']['height'], 'small');
$images['pngmedium'] = $pngimage->get_resized_image($ihConf['medium']['width'], $ihConf['medium']['height'], 'medium');
$images['pnglarge'] = $pngimage->get_resized_image($ihConf['large']['width'], $ihConf['large']['height'], 'large');
$jpgimage = new ih_image(basename($ihConf['dir']['admin']) . "/" . 'images/ih-test.jpg', intval($ihConf['small']['width']), intval($ihConf['small']['height']));
$images['jpgsource'] = $jpgimage->get_resized_image(intval($ihConf['small']['width']), intval($ihConf['small']['height']), 'orig');
$images['jpgsmall'] = $jpgimage->get_resized_image($ihConf['small']['width'], $ihConf['small']['height'], 'small');
$images['jpgmedium'] = $jpgimage->get_resized_image($ihConf['medium']['width'], $ihConf['medium']['height'], 'medium');
$images['jpglarge'] = $jpgimage->get_resized_image($ihConf['large']['width'], $ihConf['large']['height'], 'large');
$gifimage = new ih_image(basename($ihConf['dir']['admin']) . "/" . 'images/ih-test.gif', intval($ihConf['small']['width']), intval($ihConf['small']['height']));
$images['gifsource'] = $gifimage->get_resized_image(intval($ihConf['small']['width']), intval($ihConf['small']['height']), 'orig');
$images['gifsmall'] = $gifimage->get_resized_image($ihConf['small']['width'], $ihConf['small']['height'], 'small');
$images['gifmedium'] = $gifimage->get_resized_image($ihConf['medium']['width'], $ihConf['medium']['height'], 'medium');
$images['giflarge'] = $gifimage->get_resized_image($ihConf['large']['width'], $ihConf['large']['height'], 'large');
?>
Image Handler4 v4.0 for v1.5.x
Image Handler4 v4.0 for v1.5.x is based on an original contribution by Tim Kröger.