本文整理汇总了PHP中Image::getSize方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::getSize方法的具体用法?PHP Image::getSize怎么用?PHP Image::getSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image
的用法示例。
在下文中一共展示了Image::getSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHTMLNodeInner
/**
* Get the html node for this element
*
* @param \DOMElement $node
* @param \AppShed\Remote\XML\DOMDocument $xml
* @param \AppShed\Remote\HTML\Settings $settings
*/
protected function getHTMLNodeInner($node, $xml, $settings)
{
if ($this->image) {
$imageDiv = $xml->createElement('div', ['class' => 'image-container']);
$node->appendChild($imageDiv);
$imageDiv->appendChild($xml->createImgElement($this->image->getUrl(), 'image', $this->image->getSize()));
}
parent::getHTMLNodeInner($node, $xml, $settings);
}
示例2: hookHome
function hookHome($params)
{
global $smarty;
$products = Product::getNewProducts((int) $params['cookie']->id_lang, 0, 5);
$smarty->assign(array('products' => $products, 'homeSize' => Image::getSize('home')));
return $this->display(__FILE__, 'blocknewestproducts.tpl');
}
示例3: hookRightColumn
function hookRightColumn($params)
{
global $smarty, $category_path;
$category_path_ids = array();
foreach ($category_path as $cat) {
$category_path_ids[] = $cat['id_category'];
}
$currency = new Currency(intval($params['cookie']->id_currency));
$bestsellers = ProductSale::getBestSalesLight(intval($params['cookie']->id_lang), 0, 25);
$best_sellers = array();
$nr = 0;
foreach ($bestsellers as $bestseller) {
if ($nr >= 5) {
break;
}
$display = false;
foreach (Product::getIndexedCategories($bestseller['id_product']) as $row) {
if (in_array($row['id_category'], $category_path_ids)) {
$display = true;
break;
}
}
if ($display) {
$bestseller['price'] = Tools::displayPrice(Product::getPriceStaticLC(intval($bestseller['id_product'])), $currency, false, false);
$best_sellers[] = $bestseller;
$nr += 1;
}
}
$smarty->assign(array('best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium'), 'static_token' => Tools::getToken(false)));
return $this->display(__FILE__, 'blockbestsellers.tpl');
}
示例4: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$this->productSort();
// Override default configuration values: cause the new products page must display latest products first.
if (!Tools::getIsset('orderway') || !Tools::getIsset('orderby')) {
$this->orderBy = 'date_add';
$this->orderWay = 'DESC';
}
$nbProducts = (int) Product::getNewProducts($this->context->language->id, null, null, true);
$this->pagination($nbProducts);
$products = Product::getNewProducts($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay);
$this->addColorsToProductList($products);
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displayLeftColumn'), 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => (int) $nbProducts, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
if ($this->ajax) {
$product_list = $this->context->smarty->fetch(_PS_THEME_DIR_ . 'product-list.tpl');
$pagination = $this->context->smarty->fetch(_PS_THEME_DIR_ . 'pagination.tpl');
$nbLeftProducts = $nbProducts - ($this->n * ($this->p - 1) + count($products));
$nbLeftProductsPercentage = ($nbProducts - $nbLeftProducts) / $nbProducts * 100;
echo Tools::jsonEncode(array('productList' => utf8_encode($product_list), 'pagination' => $pagination, 'nbRenderedProducts' => $nbProducts, 'nbLeftProducts' => $nbLeftProducts, 'nbLeftProductsPercentage' => $nbLeftProductsPercentage));
die;
} else {
$this->setTemplate(_PS_THEME_DIR_ . 'new-products.tpl');
}
}
示例5: process
public function process()
{
if ($id_supplier = Tools::getValue('id_supplier')) {
$this->supplier = new Supplier((int) $id_supplier, self::$cookie->id_lang);
if (Validate::isLoadedObject($this->supplier) and $this->supplier->active) {
$nbProducts = $this->supplier->getProducts($id_supplier, NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
$this->pagination((int) $nbProducts);
self::$smarty->assign(array('nb_products' => $nbProducts, 'products' => $this->supplier->getProducts($id_supplier, (int) self::$cookie->id_lang, (int) $this->p, (int) $this->n, $this->orderBy, $this->orderWay), 'path' => $this->supplier->active ? Tools::safeOutput($this->supplier->name) : '', 'supplier' => $this->supplier));
} else {
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
$this->errors[] = Tools::displayError('Supplier does not exist');
}
} else {
if (Configuration::get('PS_DISPLAY_SUPPLIERS')) {
$data = call_user_func(array('Supplier', 'getSuppliers'), true, (int) self::$cookie->id_lang, true);
$nbProducts = count($data);
$this->pagination($nbProducts);
$data = call_user_func(array('Supplier', 'getSuppliers'), true, (int) self::$cookie->id_lang, true, $this->p, $this->n);
$imgDir = _PS_MANU_IMG_DIR_;
foreach ($data as &$item) {
$item['image'] = !file_exists($imgDir . '/' . $item['id_supplier'] . '-medium.jpg') ? Language::getIsoById((int) self::$cookie->id_lang) . '-default' : $item['id_supplier'];
}
self::$smarty->assign(array('pages_nb' => ceil($nbProducts / (int) $this->n), 'nbSuppliers' => $nbProducts, 'mediumSize' => Image::getSize('medium'), 'suppliers' => $data, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY')));
} else {
self::$smarty->assign('nbSuppliers', 0);
}
}
}
示例6: process
public function process()
{
$this->productSort();
$nbProducts = (int) ProductSale::getNbSales();
$this->pagination($nbProducts);
self::$smarty->assign(array('products' => ProductSale::getBestSales((int) self::$cookie->id_lang, (int) $this->p - 1, (int) $this->n, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize('home')));
}
示例7: __construct
public function __construct()
{
$this->name = 'flexiblebrands';
$this->imageHomeSize = Image::getSize(ImageType::getFormatedName('home'));
$this->orderValue = array('sales' => $this->l('Sales'), 'price' => $this->l('Price'), 'discount' => $this->l('Discount'), 'add' => $this->l('Add Date'), 'rand' => $this->l('Random'));
$this->orderType = array('asc' => $this->l('Ascending'), 'desc' => $this->l('Descending'));
$this->display = array('all' => $this->l('All'), 'condition-new' => $this->l('New'), 'condition-used' => $this->l('Used'), 'condition-refurbished' => $this->l('Refurbished'));
$this->groupType = array('auto' => $this->l('Auto'), 'manual' => $this->l('Manual'));
$this->moduleLayout = array('default' => $this->l('Layout [default]'));
$this->tempPath = dirname(__FILE__) . '/images/temps/';
$this->bannerPath = dirname(__FILE__) . '/images/banners/';
$this->iconPath = dirname(__FILE__) . '/images/icons/';
if (Configuration::get('PS_SSL_ENABLED')) {
$this->livePath = _PS_BASE_URL_SSL_ . __PS_BASE_URI__ . 'modules/flexiblebrands/images/';
} else {
$this->livePath = _PS_BASE_URL_ . __PS_BASE_URI__ . 'modules/flexiblebrands/images/';
}
$this->secure_key = Tools::encrypt('ovic-' . $this->name);
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'OvicSoft [SonNC]';
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Ovic Flexible Brands Module');
$this->description = $this->l('Ovic Flexible Brands Module');
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
//$this->cache = new FlexibleBrandFastCache();
}
示例8: hookRightColumn
function hookRightColumn($params)
{
global $smarty;
$newProducts = Product::getNewProducts(intval($params['cookie']->id_lang), 0, intval(Configuration::get('NEW_PRODUCTS_NBR')));
$smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium')));
return $this->display(__FILE__, 'blocknewproducts.tpl');
}
示例9: initContent
public function initContent()
{
parent::initContent();
$this->productSort();
// Override default configuration values: cause the new products page must display latest products first.
if (!Tools::getIsset('orderway') || !Tools::getIsset('orderby')) {
$this->orderBy = 'date_add';
$this->orderWay = 'DESC';
}
$nb_products = (int) Product::getNewProducts($this->context->language->id, isset($this->p) ? (int) $this->p - 1 : null, isset($this->n) ? (int) $this->n : null, true);
$this->pagination($nb_products);
$products = Product::getNewProducts($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay);
$this->addColorsToProductList($products);
/************************* /Images Array ******************************/
if (method_exists('Product', 'getProductsImgs')) {
$image_array = array();
for ($i = 0; $i < $nb_products; $i++) {
if (isset($products[$i]['id_product'])) {
$image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
}
}
$this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
}
/************************* /Images Array ******************************/
$this->context->smarty->assign(array('products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => (int) $nb_products, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
$this->setTemplate(_PS_THEME_DIR_ . 'new-products.tpl');
}
示例10: __construct
public function __construct()
{
$this->name = 'groupcategory';
//$this->cache = new GroupCategoryFastCache();
$this->arrType = array('saller' => $this->l('Best Sellers'), 'view' => $this->l('Most View'), 'special' => $this->l('Specials'), 'arrival' => $this->l('New Arrivals'));
$this->secure_key = Tools::encrypt('ovic-soft[group-category]' . $this->name);
$this->imageHomeSize = Image::getSize(ImageType::getFormatedName('home'));
$this->arrLayout = array('default' => $this->l('Layout [default]'));
$this->pathTemp = dirname(__FILE__) . '/images/temps/';
$this->pathBanner = dirname(__FILE__) . '/images/banners/';
$this->pathIcon = dirname(__FILE__) . '/images/icons/';
if (Configuration::get('PS_SSL_ENABLED')) {
$this->livePath = _PS_BASE_URL_SSL_ . __PS_BASE_URI__ . 'modules/groupcategory/images/';
} else {
$this->livePath = _PS_BASE_URL_ . __PS_BASE_URI__ . 'modules/groupcategory/images/';
}
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'OvicSoft';
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Supershop - Group Category Module');
$this->description = $this->l('Group Category Module');
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
}
示例11: initContent
public function initContent()
{
if (Configuration::get('PS_DISPLAY_BEST_SELLERS')) {
parent::initContent();
$this->productSort();
$nb_products = (int) ProductSale::getNbSales();
$this->pagination($nb_products);
if (!Tools::getValue('orderby')) {
$this->orderBy = 'sales';
}
$products = ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay);
$this->addColorsToProductList($products);
/************************* /Images Array ******************************/
if (method_exists('Product', 'getProductsImgs')) {
$image_array = array();
for ($i = 0; $i < $nb_products; $i++) {
if (isset($products[$i]['id_product'])) {
$image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
}
}
$this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
}
/************************* /Images Array ******************************/
$this->context->smarty->assign(array('products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nb_products, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
$this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl');
} else {
Tools::redirect('index.php?controller=404');
}
}
示例12: image
public function image()
{
$image = new Image('http://sinastorage.com/sandbox/test.jpg');
$image->rotate(50);
$s3 = new S3();
$result = $s3->plainWrite('test.jpg', $image->getContent(), $image->getSize(), $image->getMimeType());
Common::debug($result);
}
示例13: hookRightColumn
function hookRightColumn($params)
{
global $smarty;
if ($special = Product::getRandomSpecial(intval($params['cookie']->id_lang))) {
$smarty->assign(array('special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'] / (1 + $special['rate'] / 100), 2), 'oldPrice' => $special['price'] + $special['reduction'], 'mediumSize' => Image::getSize('medium')));
}
return $this->display(__FILE__, 'blockspecials.tpl');
}
示例14: process
public function process()
{
parent::process();
$this->productSort();
$nbProducts = Product::getPricesDrop((int) self::$cookie->id_lang, NULL, NULL, true);
$this->pagination($nbProducts);
self::$smarty->assign(array('products' => Product::getPricesDrop((int) self::$cookie->id_lang, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize('home')));
}
示例15: hookDisplayHome
public function hookDisplayHome($params)
{
$categoryRoot = new Category(Configuration::get('PS_HOME_CATEGORY'), $this->context->language->id, $this->context->shop->id);
$categoriesHome = $categoryRoot->getSubCategoriesMatrassHome($this->context->language->id);
//функция описана в classes Category.php
$this->smarty->assign(array('subcategories' => $categoriesHome, 'homeSize' => Image::getSize('medium_default')));
return $this->display(__FILE__, 'blockhomecategorys.tpl');
}