function cw_user_get_avatar($user)
{
    cw_load('image');
    $images = cw_image_get_list('customers_images', $user);
    return $images[0];
}
Ejemplo n.º 2
0
<?php

global $action, $mode, $current_area;
cw_load('image');
$file_upload_data =& cw_session_register('file_upload_data');
cw_image_clear(array('customers_images'));
if ($action == 'delete_photos' && !empty($user_image_id)) {
    cw_image_delete($user_image_id, 'customers_images');
}
if ($action == 'customer_images') {
    if (cw_image_check_posted($file_upload_data['customers_images'])) {
        $images = cw_image_get_list('customers_images', $user);
        if (is_array($images)) {
            foreach ($images as $image) {
                cw_image_delete($image['image_id'], 'customers_images');
            }
        }
        cw_image_save($file_upload_data['customers_images'], array('id' => $user));
    }
}
if ($current_area == 'C') {
    cw_header_location("index.php?target={$target}");
} else {
    cw_header_location("index.php?target={$target}&mode=modify&user={$user}");
}
    foreach ($image as $key => $value) {
        cw_array2update('attributes_images', $value, "image_id = '{$key}'");
    }
    cw_header_location('index.php?target=' . $target . '&mode=att&attribute_id=' . $attribute_id);
}
if ($mode == 'att' && isset($attribute_id)) {
    $attribute = array();
    if ($attribute_id) {
        $attribute = cw_func_call('cw_attributes_get_attribute', array('attribute_id' => $attribute_id, 'language' => $edited_language));
    }
    if ($attribute_modified_data) {
        $attribute = array_merge($attribute, $attribute_modified_data);
        $attribute_modified_data = '';
    }
    $smarty->assign('attribute', $attribute);
    $images = cw_image_get_list('attributes_images', $attribute_id, 0);
    $smarty->assign('images', $images);
    $location[] = array(cw_get_langvar_by_name('lbl_attributes'), '');
    $smarty->assign('main', 'attribute');
} elseif ($mode == 'att') {
    if ($sort) {
        $search_data['attributes']['sort_field'] = $sort;
    }
    if (isset($sort_direction)) {
        $search_data['attributes']['sort_direction'] = $sort_direction;
    }
    if (!$search_data['attributes']['sort_field']) {
        $search_data['attributes']['sort_field'] = 'name';
    }
    # kornev, addon attributes are hidden
    # kornev, since the attributes are multi-lng now - we cannot hide it anymore
    foreach ($file_upload_data['magnifier_images'] as $image) {
        $image_posted = cw_image_check_posted($image);
        if ($image_posted) {
            $image_id = cw_image_save($image, array('id' => $product_id));
            $image = cw_image_get('magnifier_images', $image_id);
            $dir_name = cw_magnifier_create($image['image_path'], $image_id);
            db_query("update {$tables['magnifier_images']} set image_path='{$dir_name}/TileGroup0/0-0-0.jpg' where image_id='{$image_id}'");
        }
    }
    $top_message['content'] = cw_get_langvar_by_name('msg_adm_images_added_4zoomer');
    cw_refresh($product_id, 'zoomer');
}
if ($action == "zoomer_update_availability" && !empty($zoomer_image)) {
    # Update images
    foreach ($zoomer_image as $key => $value) {
        db_query("UPDATE {$tables['magnifier_images']} SET orderby='" . $value['orderby'] . "', avail='" . $value['avail'] . "' WHERE image_id='{$key}'");
    }
    $top_message['content'] = cw_get_langvar_by_name("msg_adm_images_updated_4zoomer");
    cw_refresh($product_id, 'zoomer');
}
if ($action == "product_zoomer_delete") {
    if (!empty($iids)) {
        foreach ($iids as $image_id => $tmp) {
            cw_image_delete($image_id, 'magnifier_images');
        }
    }
    $top_message['content'] = cw_get_langvar_by_name("msg_adm_images_deleted_4zoomer");
    cw_refresh($product_id, 'zoomer');
}
$smarty->assign('zoomer_images', cw_image_get_list('magnifier_images', $product_id));
<?php

cw_load('image');
# Collect product images
$images = cw_image_get_list('products_detailed_images', $product_id, $current_area == 'C' ? 1 : 0);
if (isset($product_info['image_det']['image_id'])) {
    array_unshift($images, $product_info['image_det']);
}
// Integration with product_options addon
// DPI addon must be called after PO, pay attention to orderby of these addons
if (isset($variants) && is_array($variants)) {
    foreach ($variants as $vid => $v) {
        if (!isset($v['image']['image_id'])) {
            continue;
        }
        $v['image']['variant_id'] = $vid;
        $images[] = $v['image'];
    }
}
$smarty->assign('images', $images);
$max_x = 0;
$max_y = 0;
// get max size for window
if (is_array($images)) {
    foreach ($images as $image) {
        if ($image['image_x'] > $max_x) {
            $max_x = $image['image_x'];
        }
        if ($image['image_y'] > $max_y) {
            $max_y = $image['image_y'];
        }
<?php

# [TOFIX]
# kornev, move to addon
if (!$addons['magnifier']) {
    cw_close_window();
}
cw_load('image');
if ($image_id) {
    $image = cw_image_get('magnifier_images', $image_id);
}
$product = cw_func_call('cw_product_get', array('id' => $product_id, 'user_account' => $user_account));
$zoomer_images = cw_image_get_list('magnifier_images', $product_id, $current_area == 'C' ? 1 : 0);
if (!$image_id) {
    $image = cw_image_get('magnifier_images', $zoomer_images[0]['image_id']);
}
if (!$product || !$image) {
    cw_close_window();
}
$location[] = array($product['product'], '');
$location[] = array(cw_get_langvar_by_name('lbl_magnifier_image'), '');
$smarty->assign('images_count', count($zoomer_images));
if (is_array($zoomer_images)) {
    foreach ($zoomer_images as $k => $v) {
        $zoomer_images[$k]['image_path'] = dirname(dirname($v['tmbn_url']));
    }
}
$smarty->assign('zoomer_images', $zoomer_images);
$smarty->assign('image_path', dirname(dirname($image['tmbn_url'])));
$smarty->assign('product_id', $product_id);
$smarty->assign('home_style', 'iframe');