function get_png_by_selement($info) { $image = get_image_by_imageid($info['iconid']); return $image['image'] ? imagecreatefromstring($image['image']) : get_default_image(); }
function olc_image($src, $alt = '', $width = '', $height = '', $parameters = '') { global $server, $force_scale; if (!$src) { $src = get_default_image(); } $not_image_required = IMAGE_REQUIRED == FALSE_STRING_S; if ($not_image_required) { if (!$src || $src == DIR_WS_IMAGES) { return false; } } $rep = array(QUOTE => '"'); $src = olc_parse_input_field_data($src, $rep); /* if (IS_MULTI_SHOP) { $src=olc_set_multi_shop_dir_info($src); } */ //Don't calculate if the image is a button //or set to a "%" width and/or height //or if a 'pixel' image is being passed (hope you dont have pixels for sale!) if ($force_scale) { $do_calculate = true; } elseif (strstr($src, '/buttons/') == false) { if (strstr($src, '/manufacturers/') == false) { if (strstr($width, PERCENT) == false) { if (strstr($height, PERCENT) == false) { $do_calculate = strstr($src, 'pixel') == false; } } } } if ($do_calculate) { if (strpos($src, HASH . DOT) === false) { if (DO_IMAGE_ON_THE_FLY) { if (!file_exists($src)) { $dir = DIR_WS_THUMBNAIL_IMAGES; if (strpos($src, $dir) !== false) { $img_type = 'thumbnail'; } else { $dir = DIR_WS_INFO_IMAGES; if (strpos($src, $dir) !== false) { $img_type = 'info'; } else { $dir = DIR_WS_POPUP_IMAGES; if (strpos($src, $dir) !== false) { $img_type = 'popup'; } else { if (strpos($src, DIR_WS_ORIGINAL_IMAGES) !== false) { $src = get_default_image(); } else { $img_type = EMPTY_STRING; } } } } if ($img_type) { if ($force_scale) { $srcn = $src; } else { $srcn = str_replace($img_type, 'original', $src); } $products_image_name = basename($srcn); $src_path = ADMIN_PATH_PREFIX . $srcn; if (file_exists($src_path)) { $processsor = DIR_WS_INCLUDES . 'product_' . $img_type . '_images.php'; if (NOT_IS_ADMIN_FUNCTION) { $prefix = 'admin/'; $processsor = $prefix . $processsor; } //$src_manipulation_text='image_manipulation'; if (!class_exists('image_manipulation')) { $dir_fs_catalog = 'DIR_FS_CATALOG_'; define($dir_fs_catalog . 'IMAGES', ADMIN_PATH_PREFIX . DIR_WS_IMAGES); define($dir_fs_catalog . 'ORIGINAL_IMAGES', ADMIN_PATH_PREFIX . DIR_WS_ORIGINAL_IMAGES); define($dir_fs_catalog . 'THUMBNAIL_IMAGES', ADMIN_PATH_PREFIX . DIR_WS_THUMBNAIL_IMAGES); define($dir_fs_catalog . 'INFO_IMAGES', ADMIN_PATH_PREFIX . DIR_WS_INFO_IMAGES); define($dir_fs_catalog . 'POPUP_IMAGES', ADMIN_PATH_PREFIX . DIR_WS_POPUP_IMAGES); include_once $prefix . DIR_WS_CLASSES . 'image_manipulator.php'; } include $processsor; } else { return EMPTY_STRING; } } } } if (CONFIG_CALCULATE_IMAGE_SIZE) { // Do we calculate the image size? $do_calculate = !$width || !$height || $force_scale; if ($do_calculate) { $src_size = @getimagesize($src); if (!$src_size) { $src_size = @getimagesize(get_default_image()); } if ($src_size) { $src_width = $src_size[0]; $src_height = $src_size[1]; // Set the width and height to the proper ratio if (!($width || $height)) { $width = $src_width; $height = $src_height; $ratio = $width / $height; } else { if (!$width) { $ratio = $height / $src_height; $width = intval($src_width * $ratio); } else { $ratio = $width / $src_width; $height = intval($src_height * $ratio); } } // Scale the image if not the original size if ($src_width != $width || $src_height != $height || $force_scale) { $rx = $src_width / $width; $ry = $src_height / $height; if ($rx < $ry) { $width = intval($height / $ratio); } else { $height = intval($width * $ratio); } } } elseif ($not_image_required) { return false; } } } } } // Add remaining image parameters if they exist $src = '<img src="' . $src . '" style="border:0px"'; if (olc_not_null($alt)) { $alt = olc_parse_input_field_data($alt, $rep); $src .= ' title="' . $alt . QUOTE; } $src .= ' alt="' . $alt . QUOTE; if ($width) { $src .= ' width="' . $width . QUOTE; } if ($height) { $src .= ' height="' . $height . QUOTE; } if ($parameters) { $src .= BLANK . $parameters; } else { $src .= ' align="middle"'; } $src .= '/>'; return $src; }
# ---------------------------------------------------------------------- */ $product_alias = $_REQUEST['prod_name']; $type_alias = $_REQUEST['prod_type']; /* # ---------------------------------------------------------------------- # CALL FUNCTION # ---------------------------------------------------------------------- */ $product = get_product($product_alias, $type_alias); $default_image = get_default_image($product['type_id']); /* -- PRODUCT THUMBNAILS ON MD LG --- */ $images = get_product_images($product['type_id']); /* --- PRODUCT THUMBNAILS ON XS SM --- */ $images_xs = get_product_images($product['type_id']); $types = get_product_type($product['id']); $stock = get_product_stock($product['type_id']); $sold_out = get_product_sold_out($product['type_id']); /* --- DISCOUNT --- */ $price = discount_price($product['promo_id'], $product['promo_value'], $product['type_price'], $product['promo_start_datetime'], $product['promo_end_datetime']);
function get_banner_image_data($b_row, $image_name) { $uploaddir = SERVER_PATH_TO_ADMIN . "temp/"; //print_r($_FILES); if ($_FILES[$image_name]['tmp_name']) { // a new image was uploaded $uploadfile = $uploaddir . md5(session_id()) . $image_name . $_FILES[$image_name]['name']; move_uploaded_file($_FILES[$image_name]['tmp_name'], $uploadfile); $fh = fopen($uploadfile, 'rb'); $contents = fread($fh, filesize($uploadfile)); fclose($fh); //imagecreatefrompng($uploadfile); $contents = addslashes(base64_encode($contents)); //echo "$image_name<b>$contents</b><br>"; unlink($uploadfile); } elseif ($b_row[$image_name] != '') { // use the old image $contents = addslashes($b_row[$image_name]); //echo "using the old file<p>"; } else { //echo "using the default file $image_name<p>"; $contents = addslashes(get_default_image($image_name)); } //echo "$image_name<b>$contents</b><br>"; return $contents; }
if ($resize) { $ico = imageThumb($ico, $width, $height); } $w = imagesx($ico); $h = imagesy($ico); $css .= 'div.sysmap_iconid_' . $image['imageid'] . '{' . ' height: ' . $h . 'px;' . ' width: ' . $w . 'px;' . ' background: url("imgstore.php?iconid=' . $image['imageid'] . '&width=' . $w . '&height=' . $h . '") no-repeat center center;}' . "\n"; } echo $css; } elseif (isset($_REQUEST['iconid'])) { $iconid = get_request('iconid', 0); if ($iconid > 0) { $image = get_image_by_imageid($iconid); $image = $image['image']; $source = imageFromString($image); } else { $source = get_default_image(); } if ($resize) { $source = imageThumb($source, $width, $height); } imageOut($source); } elseif (isset($_REQUEST['imageid'])) { $imageid = get_request('imageid', 0); session_start(); if (isset($_SESSION['image_id'][$imageid])) { echo $_SESSION['image_id'][$imageid]; unset($_SESSION['image_id'][$imageid]); } session_write_close(); } require_once dirname(__FILE__) . '/include/page_footer.php';
function process_image($BID) { if (!is_numeric($BID)) { return false; } $BANNER_DIR = get_banner_dir(); $sql = "select * from banners where banner_id='" . $BID . "'"; $result = mysql_query($sql) or die(mysql_error() . $sql); $b_row = mysql_fetch_array($result); // initialize banner values: if (!$b_row['block_width']) { $b_row['block_width'] = 10; } if (!$b_row['block_height']) { $b_row['block_height'] = 10; } $BLK_WIDTH = $b_row['block_width']; $BLK_HEIGHT = $b_row['block_height']; $G_WIDTH = $b_row['grid_width']; $G_HEIGHT = $b_row['grid_height']; if (!$b_row['grid_block']) { $b_row['grid_block'] = get_default_image('grid_block'); } if (!$b_row['nfs_block']) { $b_row['nfs_block'] = get_default_image('nfs_block'); } $file_path = SERVER_PATH_TO_ADMIN; $progress .= 'Please wait.. Processing the Grid image with GD'; if (function_exists("imagecreatetruecolor")) { $map = imagecreatetruecolor($G_WIDTH * $BLK_WIDTH, $G_HEIGHT * $BLK_HEIGHT); } else { $map = imagecreate($G_WIDTH * $BLK_WIDTH, $G_HEIGHT * $BLK_HEIGHT); } //$block = imagecreatefrompng ( $file_path."temp/block.png" ); $block = imagecreatefromstring(base64_decode($b_row['grid_block'])); // initialise the map, tile it with blocks $i = 0; $j = 0; $x_pos = 0; $y_pos = 0; for ($i = 0; $i < $G_HEIGHT; $i++) { for ($j = 0; $j < $G_WIDTH; $j++) { imagecopy($map, $block, $x_pos, $y_pos, 0, 0, $BLK_WIDTH, $BLK_HEIGHT); $x_pos += $BLK_WIDTH; } $x_pos = 0; $y_pos += $BLK_HEIGHT; } # copy the NFS blocks. //$nfs_block = imagecreatefrompng ( $file_path."temp/not_for_sale_block.png" ); $nfs_block = imagecreatefromstring(base64_decode($b_row['nfs_block'])); $sql = "select * from blocks where status='nfs' AND banner_id='{$BID}' "; $result = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { imagecopy($map, $nfs_block, $row['x'], $row['y'], 0, 0, $BLK_WIDTH, $BLK_HEIGHT); } imagedestroy($nfs_block); # blend in the background if (file_exists(SERVER_PATH_TO_ADMIN . "temp/background{$BID}.png") && function_exists("imagealphablending")) { $background = imagecreatefrompng(SERVER_PATH_TO_ADMIN . "temp/background{$BID}.png"); imagealphablending($map, true); $MaxW = imagesx($background); //Edit by -J- $MaxH = imagesy($background); //Edit by -J- imagecopy($map, $background, 0, 0, 0, 0, $MaxW, $MaxH); imagedestroy($background); } // crate a map form the images in the db $sql = "select * from blocks where approved='Y' and status='sold' AND image_data <> '' AND banner_id='{$BID}' "; $result = mysql_query($sql) or die(mysql_error()); $i = 0; while ($row = mysql_fetch_array($result)) { $data = $row[image_data]; if (strlen($data) != 0) { $block = base64_decode($data); $block = imagecreatefromstring($block); } else { $block = imagecreatefrompng($file_path . "temp/block.png"); } imagecopy($map, $block, $row['x'], $row['y'], 0, 0, $BLK_WIDTH, $BLK_HEIGHT); imagedestroy($block); } // save //imagejpeg($map); if (OUTPUT_JPEG == 'Y' && function_exists("imagejpeg")) { if (INTERLACE_SWITCH == 'YES') { imageinterlace($map, 1); } touch($file_path . "temp/temp{$BID}.jpg"); imagejpeg($map, $file_path . "temp/temp{$BID}.jpg", JPEG_QUALITY); $progress .= "<br>Saved as " . $file_path . "temp/temp{$BID}.jpg<br>"; } elseif (OUTPUT_JPEG == 'N') { if (INTERLACE_SWITCH == 'YES') { imageinterlace($map, 1); } touch($file_path . "temp/temp{$BID}.png"); imagepng($map, $file_path . "temp/temp{$BID}.png"); $progress .= "<br>Saved as " . $file_path . "temp/temp{$BID}.png<br>"; } elseif (OUTPUT_JPEG == 'GIF') { if (INTERLACE_SWITCH == 'YES') { imageinterlace($map, 1); } //$fh = fopen ($file_path."temp/temp$BID.gif", 'wb'); // echo 'touching '.$file_path."temp/temp$BID.gif<br>"; touch($file_path . "temp/temp{$BID}.gif"); imagegif($map, $file_path . "temp/temp{$BID}.gif"); $progress .= "<br>Saved as " . $file_path . "temp/temp{$BID}.gif<br>"; //fclose($fh); } //imagepng($map, $file_path."temp/temp.png"); imagedestroy($map); return $progress; }
the_row(); echo '<div class="grid-item half">'; // display a sub field value //header with image byline & title echo '<div class="item-header">'; $content = get_sub_field('content') ? get_sub_field('content') : false; $header = get_sub_field('header') ? get_sub_field('header') : false; $byline = get_sub_field('byline') ? get_sub_field('byline') : false; $excerpt = get_sub_field('excerpt') ? get_sub_field('excerpt') : false; $image = get_sub_field('image') ? get_sub_field('image') : false; if ($image) { $image = wp_get_attachment_image_src($image, 'square'); $image = $image[0]; $alt = get_sub_field('alt'); } else { $image = get_default_image(); $alt = 'default Image'; } echo '<div class="item-header--image">'; echo '<img src="' . $image . '" alt="' . $alt . '">'; echo '</div>'; echo '<div class="item-header--meta">'; echo '<h3 class="item-doctor">' . $header . '</h3>'; echo '<p class="item-byline">' . $byline . '</p>'; echo '<div class="item-excerpt">' . $excerpt . '</div>'; echo '<div class="readmore">read more</div>'; echo '</div>'; echo '</div>'; echo '<div class="grid-item--content">' . $content . '<div class="readless">Read Less</div></div>'; echo '</div>'; }
function get_png_by_selement($selement, $info) { switch ($info['icon_type']) { case SYSMAP_ELEMENT_ICON_ON: $info['iconid'] = $selement['iconid_on']; break; case SYSMAP_ELEMENT_ICON_UNKNOWN: $info['iconid'] = $selement['iconid_unknown']; break; case SYSMAP_ELEMENT_ICON_MAINTENANCE: $info['iconid'] = $selement['iconid_maintenance']; break; case SYSMAP_ELEMENT_ICON_DISABLED: $info['iconid'] = $selement['iconid_disabled']; break; case SYSMAP_ELEMENT_ICON_OFF: default: // element image $info['iconid'] = $selement['iconid_off']; break; } // Process for default icons if ($info['iconid'] == 0) { $info['iconid'] = $selement['iconid_off']; } //------ $image = get_image_by_imageid($info['iconid']); if (!$image) { return get_default_image(true); } return imagecreatefromstring($image['image']); }
<?php // accepts $_REQUEST['BID'] and $_REQUEST['image_name'] define('NO_HOUSE_KEEP', 'YES'); require '../config.php'; $row = load_banner_constants($_REQUEST['BID']); $image = $row[$_REQUEST['image_name']]; if ($image == '') { $image = get_default_image($_REQUEST['image_name']); } header("Cache-Control: max-age=60, must-revalidate"); // HTTP/1.1 header("Expires: " . gmdate('r', time() + 60)); // Date in the past header("Content-type: image/x-png"); echo base64_decode($image);
foreach ($images as $inum => $image) { //SDI($image['image']); $image['image'] = zbx_unescape_image(base64_decode($image['image'])); $ico = imagecreatefromstring($image['image']); $w = imagesx($ico); $h = imagesy($ico); $css .= 'div.sysmap_iconid_' . $image['imageid'] . '{' . ' height: ' . $h . 'px; ' . ' width: ' . $w . 'px; ' . ' background-image: url("imgstore.php?iconid=' . $image['imageid'] . '");' . ' background-repeat:no-repeat; }' . "\n"; } print $css; } else { if (isset($_REQUEST['iconid'])) { $iconid = get_request('iconid', 0); if ($iconid > 0) { $image = get_image_by_imageid($iconid); print $image['image']; } else { $image = get_default_image(true); ImageOut($image); } } else { if (isset($_REQUEST['imageid'])) { session_start(); $imageid = get_request('imageid', 0); if (isset($_SESSION['image_id'][$imageid])) { echo $_SESSION['image_id'][$imageid]; unset($_SESSION['image_id'][$imageid]); } } } } include_once 'include/page_footer.php';
if (empty($selements)) { print 'ZBX_SYSMAPS[' . $cmapid . '].map.info("' . S_GET_IMG_ELEMENT_DATA_NOT_FOUND . '"); '; break; } $selement = reset($selements); $selement['sysmapid'] = $sysmapid; // $selement['image'] = get_base64_icon($element); $selement['image'] = get_selement_iconid($selement); $selement['label_expanded'] = resolveMapLabelMacrosAll($selement); $action = ''; $action .= 'ZBX_SYSMAPS[' . $cmapid . '].map.add_selement(' . zbx_jsvalue($selement) . ',1);'; // $action.= 'ZBX_SYSMAPS['.$cmapid.'].map.updateMapImage();'; print $action; break; case 'new_selement': $default_icon = get_default_image(false); $selements = get_request('selements', '[]'); $selements = $json->decode($selements, true); if (!empty($selements)) { $selement = reset($selements); $selement['iconid_off'] = $default_icon['imageid']; // $selement['image'] = get_base64_icon($element); $selement['image'] = get_selement_iconid($selement); $action = ''; $action .= 'ZBX_SYSMAPS[' . $cmapid . '].map.add_selement(' . zbx_jsvalue($selement) . ',1);'; $action .= 'ZBX_SYSMAPS[' . $cmapid . '].map.updateMapImage();'; $action .= 'ZBX_SYSMAPS[' . $cmapid . '].map.show_selement_list();'; print $action; } else { print 'ZBX_SYSMAPS[' . $cmapid . '].map.info("' . S_GET_IMG_ELEMENT_DATA_NOT_FOUND . '"); '; }
function load_banner_constants($BID) { $row = load_banner_row($BID); // defaults if (!$row['block_width']) { $row['block_width'] = 10; } if (!$row['block_height']) { $row['block_height'] = 10; } if (!$row['grid_block']) { $row['grid_block'] = get_default_image('grid_block'); } if (!$row['nfs_block']) { $row['nfs_block'] = get_default_image('nfs_block'); } if (!$row['usr_grid_block']) { $row['usr_grid_block'] = get_default_image('usr_grid_block'); } if (!$row['usr_nfs_block']) { $row['usr_nfs_block'] = get_default_image('usr_nfs_block'); } if (!$row['usr_sel_block']) { $row['usr_sel_block'] = get_default_image('usr_sel_block'); } if (!$row['usr_ord_block']) { $row['usr_ord_block'] = get_default_image('usr_ord_block'); } if (!$row['usr_res_block']) { $row['usr_res_block'] = get_default_image('usr_res_block'); } if (!$row['usr_sol_block']) { $row['usr_sol_block'] = get_default_image('usr_sol_block'); } // define constants define("G_NAME", $row['name']); define("G_PRICE", $row['price_per_block']); define("G_CURRENCY", $row['currency']); define("DAYS_EXPIRE", $row['days_expire']); define("BLK_WIDTH", $row['block_width']); define("BLK_HEIGHT", $row['block_height']); define("BANNER_ID", $row['banner_id']); define("G_WIDTH", $row['grid_width']); define("G_HEIGHT", $row['grid_height']); define("GRID_BLOCK", base64_decode($row['grid_block'])); define("NFS_BLOCK", base64_decode($row['nfs_block'])); define("USR_GRID_BLOCK", base64_decode($row['usr_grid_block'])); define("USR_NFS_BLOCK", base64_decode($row['usr_nfs_block'])); define("USR_SEL_BLOCK", base64_decode($row['usr_sel_block'])); define("USR_ORD_BLOCK", base64_decode($row['usr_ord_block'])); define("USR_RES_BLOCK", base64_decode($row['usr_res_block'])); define("USR_SOL_BLOCK", base64_decode($row['usr_sol_block'])); define("G_BGCOLOR", $row['bgcolor']); define("AUTO_APPROVE", $row['auto_approve']); define("AUTO_PUBLISH", $row['auto_publish']); define("G_MAX_ORDERS", $row['max_orders']); define("G_MAX_BLOCKS", $row['max_blocks']); define("G_MIN_BLOCKS", $row['min_blocks']); //define ("BANNER_ROW", serialize($row)); return $row; }