本文整理匯總了PHP中ImageType::getByNameNType方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImageType::getByNameNType方法的具體用法?PHP ImageType::getByNameNType怎麽用?PHP ImageType::getByNameNType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImageType
的用法示例。
在下文中一共展示了ImageType::getByNameNType方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: displayFormAttributes
//.........這裏部分代碼省略.........
</select> <sup>*</sup>
<span id="span_impact"> ' . $this->l('of') . ' ' . ($currency->format == 1 ? $currency->sign . ' ' : '') . '
<input type="text" size="6" name="attribute_price" id="attribute_price" value="0.00" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\');"/>' . ($currency->format == 2 ? ' ' . $currency->sign : '') . '
</span>
</td>
</tr>
<tr>
<td style="width:150px">' . $this->l('Impact on weight:') . '</td>
<td colspan="2" style="padding-bottom:5px;"><select name="attribute_weight_impact" id="attribute_weight_impact" style="width: 140px;" onchange="check_weight_impact();">
<option value="0">' . $this->l('None') . '</option>
<option value="1">' . $this->l('Increase') . '</option>
<option value="-1">' . $this->l('Reduction') . '</option>
</select>
<span id="span_weight_impact"> ' . $this->l('of') . '
<input type="text" size="6" name="attribute_weight" id="attribute_weight" value="0.00" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\');" /> ' . Configuration::get('PS_WEIGHT_UNIT') . '</span></td>
</tr>
<tr>
<td style="width:150px">' . $this->l('Eco-tax:') . '</td>
<td style="padding-bottom:5px;">' . ($currency->format == 1 ? $currency->sign . ' ' : '') . '<input type="text" size="3" name="attribute_ecotax" id="attribute_ecotax" value="0.00" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\');" />' . ($currency->format == 2 ? ' ' . $currency->sign : '') . ' (' . $this->l('overrides Eco-tax on Information tab') . ')</td>
</tr>
<tr>
<td style="width:150px">' . $this->l('Quantity:') . '</td>
<td style="padding-bottom:5px;"><input type="text" size="3" name="attribute_quantity" id="attribute_quantity" value="1" /> (' . $this->l('overrides Quantity on Information tab') . ')</td>
</tr>
<tr>
<td colspan="2"><sup>*</sup> ' . $this->l('included tax') . '</td>
</tr>
<tr><td colspan="2"><hr style="width:730px;"></td></tr>
<tr>
<td style="width:150px">' . $this->l('Image:') . '</td>
<td style="padding-bottom:5px;">
<ul id="id_image_attr">';
$i = 0;
$imageType = ImageType::getByNameNType('small', 'products');
$imageWidth = (isset($imageType['width']) ? intval($imageType['width']) : 64) + 25;
foreach ($images as $image) {
echo '<li style="float: left; width: ' . $imageWidth . 'px;"><input type="checkbox" name="id_image_attr[]" value="' . intval($image['id_image']) . '" id="id_image_attr_' . intval($image['id_image']) . '" />
<label for="id_image_attr_' . intval($image['id_image']) . '" style="float: none;"><img src="../img/p/' . $obj->id . '-' . $image['id_image'] . '-small.jpg" alt="' . htmlentities(stripslashes($image['legend']), ENT_COMPAT, 'UTF-8') . '" title="' . htmlentities(stripslashes($image['legend']), ENT_COMPAT, 'UTF-8') . '" /></label></li>';
++$i;
}
echo '</ul>
<img id="pic" alt="" title="" style="display: none; width: 100px; height: 100px; float: left; border: 1px dashed #BBB; margin-left: 20px;" />
</td>
</tr>
<tr>
<td style="width:150px">' . $this->l('Default:') . '<br /><br /></td>
<td style="padding-bottom:5px;">
<input type="checkbox" name="attribute_default" id="attribute_default" value="1" /> ' . $this->l('Make the default combination for this product') . '<br /><br />
</td>
</tr>
<tr>
<td style="width:150px"> </td>
<td style="padding-bottom:5px;">
<span style="float: left;"><input type="submit" name="submitProductAttribute" id="submitProductAttribute" value="' . $this->l('Add this combination') . '" class="button" onclick="attr_selectall();" /> </span>
<span id="ResetSpan" style="float: left; margin-left: 8px; display: none;">
<input type="reset" name="ResetBtn" id="ResetBtn" onclick="if (!confirm(\'' . $this->l('Are you sure you want to cancel?', __CLASS__, true, false) . '\')) return;
init_elems(); getE(\'submitProductAttribute\').value = \'' . $this->l('Add this attributes group', __CLASS__, true) . '\';
getE(\'id_product_attribute\').value = -1; openCloseLayer(\'ResetSpan\');" class="button" value="' . $this->l('Cancel modification') . '" /></span><span style="clear: both;"></span>
</td>
</tr>
<tr><td colspan="2"><hr style="width:730px;"></td></tr>
<tr>
<td colspan="2">
<br />
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width: 600px;">
<tr>
示例2: setPicturesSettings
public function setPicturesSettings()
{
// Default
if ($medium = ImageType::getByNameNType('thickbox', 'products')) {
$sizeMedium = (int) $medium['id_image_type'];
} elseif ($medium = ImageType::getByNameNType('thickbox_default', 'products')) {
$sizeMedium = (int) $medium['id_image_type'];
} else {
$sizeMedium = 0;
}
// Small
if ($small = ImageType::getByNameNType('small', 'products')) {
$sizeSmall = (int) $small['id_image_type'];
} elseif ($small = ImageType::getByNameNType('small_default', 'products')) {
$sizeSmall = (int) $small['id_image_type'];
} else {
$sizeSmall = 0;
}
// Large
if ($large = ImageType::getByNameNType('large', 'products')) {
$sizeBig = (int) $large['id_image_type'];
} elseif ($large = ImageType::getByNameNType('large_default', 'products')) {
$sizeBig = (int) $large['id_image_type'];
} else {
$sizeBig = 0;
}
$this->setConfiguration('EBAY_PICTURE_SIZE_DEFAULT', $sizeMedium);
$this->setConfiguration('EBAY_PICTURE_SIZE_SMALL', $sizeSmall);
$this->setConfiguration('EBAY_PICTURE_SIZE_BIG', $sizeBig);
$this->setConfiguration('EBAY_PICTURE_PER_LISTING', 0);
}
示例3: displayFormAttributes
//.........這裏部分代碼省略.........
<tr id="stock_mvt_attribute" style="display:none;">
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" class="col-left">' . $this->l('Stock movement:') . '</td>
<td style="padding-bottom:5px;">
<select id="id_mvt_reason" name="id_mvt_reason">
<option value="-1">--</option>';
$reasons = StockMvtReason::getStockMvtReasons((int) $cookie->id_lang);
foreach ($reasons as $reason) {
echo '<option rel="' . $reason['sign'] . '" value="' . $reason['id_stock_mvt_reason'] . '" ' . (Configuration::get('PS_STOCK_MVT_REASON_DEFAULT') == $reason['id_stock_mvt_reason'] ? 'selected="selected"' : '') . '>' . $reason['name'] . '</option>';
}
echo '</select>
<input type="text" name="attribute_mvt_quantity" size="3" maxlength="10" value="0"/>
<span style="display:none;" id="mvt_sign"></span>
<br />
<div class="hint clear" style="display: block;width: 70%;">' . $this->l('Choose the reason and enter the quantity that you want to increase or decrease in your stock') . '</div>
</td>
</tr>
<tr>
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;" class="col-left">' . $this->l('Minimum quantity:') . '</td>
<td style="padding-bottom:5px;">
<input size="3" maxlength="10" name="attribute_minimal_quantity" id="attribute_minimal_quantity" type="text" value="' . ($this->getFieldValue($obj, 'attribute_minimal_quantity') ? $this->getFieldValue($obj, 'attribute_minimal_quantity') : 1) . '" />
<p>' . $this->l('The minimum quantity to buy this product (set to 1 to disable this feature)') . '</p>
</td>
</tr>
<tr style="display:none;" id="attr_qty_stock">
<td style="width:150px">' . $this->l('Quantity in stock:') . '</td>
<td style="padding-bottom:5px;"><b><span style="display:none;" id="attribute_quantity"></span></b></td>
</tr>
<tr><td colspan="2"><hr style="width:100%;" /></td></tr>
<tr>
<td style="width:150px">' . $this->l('Image:') . '</td>
<td style="padding-bottom:5px;">
<ul id="id_image_attr">';
$i = 0;
$imageType = ImageType::getByNameNType('small', 'products');
$imageWidth = (isset($imageType['width']) ? (int) $imageType['width'] : 64) + 25;
foreach ($images as $image) {
$imageObj = new Image($image['id_image']);
echo '<li style="float: left; width: ' . $imageWidth . 'px;"><input type="checkbox" name="id_image_attr[]" value="' . (int) $image['id_image'] . '" id="id_image_attr_' . (int) $image['id_image'] . '" />
<label for="id_image_attr_' . (int) $image['id_image'] . '" style="float: none;"><img src="' . _THEME_PROD_DIR_ . $imageObj->getExistingImgPath() . '-small.jpg" alt="' . htmlentities(stripslashes($image['legend']), ENT_COMPAT, 'UTF-8') . '" title="' . htmlentities(stripslashes($image['legend']), ENT_COMPAT, 'UTF-8') . '" /></label></li>';
++$i;
}
echo '</ul>
<img id="pic" alt="" title="" style="display: none; width: 100px; height: 100px; float: left; border: 1px dashed #BBB; margin-left: 20px;" />
</td>
</tr>
<tr>
<td style="width:150px">' . $this->l('Default:') . '<br /><br /></td>
<td style="padding-bottom:5px;">
<input type="checkbox" name="attribute_default" id="attribute_default" value="1" /> ' . $this->l('Make this the default combination for this product') . '<br /><br />
</td>
</tr>
<tr>
<td style="width:150px"> </td>
<td style="padding-bottom:5px;">
<span style="float: left;"><input type="submit" name="submitProductAttribute" id="submitProductAttribute" value="' . $this->l('Add this combination') . '" class="button" onclick="attr_selectall(); this.form.action += \'&addproduct&tabs=3\';" /> </span>
<span id="ResetSpan" style="float: left; margin-left: 8px; display: none;">
<input type="reset" name="ResetBtn" id="ResetBtn" onclick="init_elems(); getE(\'submitProductAttribute\').value = \'' . $this->l('Add this attributes group', __CLASS__, true) . '\';
getE(\'id_product_attribute\').value = 0; $(\'#ResetSpan\').slideToggle();" class="button" value="' . $this->l('Cancel modification') . '" /></span><span class="clear"></span>
</td>
</tr>
<tr><td colspan="2"><hr style="width:100%;" /></td></tr>
<tr>
<td colspan="2">
<br />
<table border="0" cellpadding="0" cellspacing="0" class="table">
<tr>
示例4: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
if (preg_match('/\\.(gif|jpe?g|png|ico)$/i', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
$this->context->cookie->disallowWriting();
if (!isset($_SERVER['REDIRECT_URL'])) {
$_SERVER['REDIRECT_URL'] = '';
if (preg_match('@^' . __PS_BASE_URI__ . '([0-9]+)\\-([_a-zA-Z0-9-]+)(/[_a-zA-Z0-9-]+)?\\.jpg$@', $_SERVER['REQUEST_URI'], $matches)) {
$_SERVER['REDIRECT_URL'] = __PS_BASE_URI__ . 'p/' . Image::getImgFolderStatic($matches[0]) . '/' . $matches[0] . '-' . $matches[1] . '.jpg';
}
}
if (preg_match('#/p[0-9/]*/([0-9]+)\\-([_a-zA-Z]*)\\.(png|jpe?g|gif)$#', $_SERVER['REDIRECT_URL'], $matches)) {
// Backward compatibility since we suffixed the template image with _default
if (Tools::strtolower(substr($matches[2], -8)) != '_default') {
header('Location: ' . $this->context->link->getImageLink('', $matches[1], $matches[2]), true, 302);
exit;
} else {
$image_type = ImageType::getByNameNType($matches[2], 'products');
if ($image_type && count($image_type)) {
$root = _PS_PROD_IMG_DIR_;
$folder = Image::getImgFolderStatic($matches[1]);
$file = $matches[1];
$ext = '.' . $matches[3];
if (file_exists($root . $folder . $file . $ext)) {
if (ImageManager::resize($root . $folder . $file . $ext, $root . $folder . $file . '-' . $matches[2] . $ext, (int) $image_type['width'], (int) $image_type['height'])) {
header('HTTP/1.1 200 Found');
header('Status: 200 Found');
header('Content-Type: image/jpg');
readfile($root . $folder . $file . '-' . $matches[2] . $ext);
exit;
}
}
}
}
} elseif (preg_match('#/c/([0-9]+)\\-([_a-zA-Z]*)\\.(png|jpe?g|gif)$#', $_SERVER['REDIRECT_URL'], $matches)) {
$image_type = ImageType::getByNameNType($matches[2], 'categories');
if ($image_type && count($image_type)) {
$root = _PS_CAT_IMG_DIR_;
$file = $matches[1];
$ext = '.' . $matches[3];
if (file_exists($root . $file . $ext)) {
if (ImageManager::resize($root . $file . $ext, $root . $file . '-' . $matches[2] . $ext, (int) $image_type['width'], (int) $image_type['height'])) {
header('HTTP/1.1 200 Found');
header('Status: 200 Found');
header('Content-Type: image/jpg');
readfile($root . $file . '-' . $matches[2] . $ext);
exit;
}
}
}
}
header('Content-Type: image/gif');
readfile(_PS_IMG_DIR_ . '404.gif');
exit;
} elseif (in_array(Tools::strtolower(substr($_SERVER['REQUEST_URI'], -3)), array('.js', 'css'))) {
$this->context->cookie->disallowWriting();
exit;
}
parent::initContent();
$this->setTemplate(_PS_THEME_DIR_ . '404.tpl');
}
示例5: initFormImages
/**
* @param Offer $obj
* @throws Exception
* @throws SmartyException
*/
public function initFormImages($obj)
{
$data = $this->createTemplate($this->tpl_form);
if ((bool) $obj->id) {
// if ($this->offer_exists_in_shop) {
$data->assign('offer', $this->loadObject());
$count_images = Db::getInstance()->getValue('
SELECT COUNT(id_offer)
FROM ' . _DB_PREFIX_ . 'offer_image
WHERE id_offer = ' . (int) $obj->id);
$images = AphOfferImage::getImages($this->context->language->id, $obj->id);
foreach ($images as $k => $image) {
$images[$k] = new AphOfferImage($image['id_image']);
}
if ($this->context->shop->getContext() == Shop::CONTEXT_SHOP) {
$current_shop_id = (int) $this->context->shop->id;
} else {
$current_shop_id = 0;
}
$language = Language::getLanguage(Configuration::get('PS_LANG_DEFAULT'));
$image_uploader = new HelperImageUploader('file');
$image_uploader->setTemplateDirectory($this->tpl_dir . 'helpers/uploader/')->setMultiple(!(Tools::getUserBrowser() == 'Apple Safari' && Tools::getUserPlatform() == 'Windows'))->setUseAjax(true)->setUrl(Context::getContext()->link->getAdminLink('AdminAphOffers') . '&ajax=1&id_offer=' . (int) $obj->id . '&action=addOfferImage')->setTemplate('ajax.tpl');
$data->assign(array('countImages' => $count_images, 'id_offer' => (int) Tools::getValue('id_offer'), 'images' => $images, 'iso_lang' => $language['iso_code'], 'token' => $this->token, 'table' => $this->table, 'max_image_size' => $this->max_image_size / 1024 / 1024, 'currency' => $this->context->currency, 'current_shop_id' => $current_shop_id, 'languages' => $this->_languages, 'default_language' => (int) Configuration::get('PS_LANG_DEFAULT'), 'image_uploader' => $image_uploader->render()));
$type = ImageType::getByNameNType('%', 'products', 'height');
if (isset($type['name'])) {
$data->assign('imageType', $type['name']);
} else {
$data->assign('imageType', ImageType::getFormatedName('small'));
}
// } else {
// $this->displayWarning($this->l('You must save the offer in this shop before adding images.'));
// }
} else {
$this->displayWarning($this->l('You must save this offer before adding images.'));
}
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
示例6: _getImageTypeFormatedName
protected static function _getImageTypeFormatedName($name)
{
if (method_exists('ImageType', 'getFormatedName')) {
return ImageType::getFormatedName($name);
} else {
$theme_name = Context::getContext()->shop->theme_name;
$name_without_theme_name = str_replace(array('_' . $theme_name, $theme_name . '_'), '', $name);
if (strstr($name, $theme_name) && ImageType::getByNameNType($name)) {
return $name;
} else {
if (ImageType::getByNameNType($name_without_theme_name . '_' . $theme_name, 'products')) {
return $name_without_theme_name . '_' . $theme_name;
} else {
return $theme_name . '_' . $name_without_theme_name;
}
}
}
}
示例7: initContentForCombinations
public function initContentForCombinations()
{
${${"GLOBALS"}["vmqqtmkyw"]} = $this->object;
if (!Combination::isFeatureActive()) {
$this->displayWarning($this->getMessage("This feature has been disabled, you can activate this feature at this page:") . $this->getMessage("link to Performances"));
return;
}
${"GLOBALS"}["weevwwkl"] = "product";
if (Validate::isLoadedObject(${${"GLOBALS"}["weevwwkl"]})) {
self::$smarty->assign("country_display_tax_label", $this->context->country->display_tax_label);
$zsahvowoo = "lang";
self::$smarty->assign("tax_exclude_taxe_option", Tax::excludeTaxeOption());
self::$smarty->assign("id_tax_rules_group", $product->id_tax_rules_group);
self::$smarty->assign("tax_rules_groups", TaxRulesGroup::getTaxRulesGroups(true));
${$zsahvowoo} = new Language($this->id_language);
self::$smarty->assign("iso_code", $lang->iso_code);
self::$smarty->assign("combinationImagesJs", $this->getCombinationImagesJs());
if ($product->is_virtual) {
$tpkpvyor = "product";
self::$smarty->assign("product", ${$tpkpvyor});
$this->displayWarning($this->getMessage("A virtual product cannot have combinations."));
} else {
${"GLOBALS"}["qqjbnscylsi"] = "attribute_js";
${"GLOBALS"}["nqxaoftbn"] = "attribute";
$bcesaxqdqqq = "images";
${"GLOBALS"}["zcxmuajd"] = "ps_stock_mvt_reason_default";
$vmytjghdfi = "attribute_js";
$nrkrfhirkx = "attributes";
${${"GLOBALS"}["qqjbnscylsi"]} = array();
$cappytc = "k";
${"GLOBALS"}["jyaoxpe"] = "attribute";
${$nrkrfhirkx} = Attribute::getAttributes($this->context->language->id, true);
foreach (${${"GLOBALS"}["ecblflvypvt"]} as ${$cappytc} => ${${"GLOBALS"}["jyaoxpe"]}) {
${$vmytjghdfi}[${${"GLOBALS"}["iixdipeiyldv"]}["id_attribute_group"]][${${"GLOBALS"}["iixdipeiyldv"]}["id_attribute"]] = ${${"GLOBALS"}["nqxaoftbn"]}["name"];
}
${"GLOBALS"}["higiwiyuxd"] = "k";
${${"GLOBALS"}["sxexnhlq"]} = new Currency((int) Configuration::get("PS_CURRENCY_DEFAULT"));
self::$smarty->assign("attributeJs", ${${"GLOBALS"}["xenfvrjowsy"]});
self::$smarty->assign("attributes_groups", AttributeGroup::getAttributesGroups($this->context->language->id));
self::$smarty->assign("currency", ${${"GLOBALS"}["sxexnhlq"]});
${"GLOBALS"}["xzqtsdnlkv"] = "images";
${$bcesaxqdqqq} = Image::getImages($this->context->language->id, $product->id);
self::$smarty->assign("tax_exclude_option", Tax::excludeTaxeOption());
$rbxbrbxg = "product";
self::$smarty->assign("ps_weight_unit", Configuration::get("PS_WEIGHT_UNIT"));
self::$smarty->assign("ps_use_ecotax", Configuration::get("PS_USE_ECOTAX"));
self::$smarty->assign("field_value_unity", $this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "unity"));
${"GLOBALS"}["vpcuib"] = "image_type";
self::$smarty->assign("reasons", ${${"GLOBALS"}["nqegxbae"]} = StockMvtReason::getStockMvtReasons($this->context->language->id));
self::$smarty->assign("ps_stock_mvt_reason_default", ${${"GLOBALS"}["zcxmuajd"]} = Configuration::get("PS_STOCK_MVT_REASON_DEFAULT"));
self::$smarty->assign("minimal_quantity", $this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "minimal_quantity") ? $this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "minimal_quantity") : 1);
self::$smarty->assign("available_date", $this->getFieldValue(${$rbxbrbxg}, "available_date") != 0 ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "available_date"), version_compare(_PS_VERSION_, "1.5.5", ">=") ? null : $this->context->language->id))) : "0000-00-00");
${${"GLOBALS"}["tqkkuicfgax"]} = 0;
${"GLOBALS"}["ucamhp"] = "product";
self::$smarty->assign("imageType", ImageType::getByNameNType("small_default", "products"));
self::$smarty->assign("imageWidth", (isset(${${"GLOBALS"}["rvkjjxqs"]}["width"]) ? (int) ${${"GLOBALS"}["vpcuib"]}["width"] : 64) + 25);
foreach (${${"GLOBALS"}["xzqtsdnlkv"]} as ${${"GLOBALS"}["higiwiyuxd"]} => ${${"GLOBALS"}["inpuwydsyk"]}) {
$cshrlmyryz = "image";
${${"GLOBALS"}["dhvuermstcbs"]}[${${"GLOBALS"}["qtxqhylrbsm"]}]["obj"] = new Image(${$cshrlmyryz}["id_image"]);
$kcvbkys = "i";
++${$kcvbkys};
}
self::$smarty->assign("images", ${${"GLOBALS"}["dhvuermstcbs"]});
self::$smarty->assign(array("combinationArray" => $this->getCombinations(${${"GLOBALS"}["ucamhp"]}, ${${"GLOBALS"}["sxexnhlq"]}), "product" => ${${"GLOBALS"}["vmqqtmkyw"]}, "id_category" => $product->getDefaultCategory(), "token_generator" => "tokengenerator", "combination_exists" => Shop::isFeatureActive() && Shop::getContextShopGroup()->share_stock && count(AttributeGroup::getAttributesGroups($this->context->language->id)) > 0));
}
} else {
self::$smarty->assign("product", ${${"GLOBALS"}["vmqqtmkyw"]});
$this->displayWarning($this->getMessage("You must save this product before adding combinations."));
}
}
示例8: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
$category_rewrite = explode('/', $_SERVER['REQUEST_URI']);
if (isset($category_rewrite[1]) && !empty($category_rewrite[1])) {
$id_category = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `id_category`
FROM `' . _DB_PREFIX_ . 'category_lang`
WHERE `link_rewrite` = \'' . $category_rewrite[1] . '\'');
if ($id_category > 0) {
$category = new Category($id_category);
if (is_object($category) && isset($category->id, $this->context->language->id)) {
$url = _PS_BASE_URL_ . __PS_BASE_URI__ . $category_rewrite[1] . '/';
$redirect_type = Configuration::get('PS_CANONICAL_REDIRECT') == 2 ? '301' : '302';
header('HTTP/1.0 ' . $redirect_type . ' Moved');
header('Cache-Control: no-cache');
Tools::redirectLink($url);
}
}
}
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
if (preg_match('/\\.(gif|jpe?g|png|ico)$/i', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
$this->context->cookie->disallowWriting();
if (!isset($_SERVER['REDIRECT_URL'])) {
$_SERVER['REDIRECT_URL'] = '';
if (preg_match('@^' . __PS_BASE_URI__ . '([0-9]+)\\-([_a-zA-Z0-9-]+)(/[_a-zA-Z0-9-]+)?\\.jpg$@', $_SERVER['REQUEST_URI'], $matches)) {
$_SERVER['REDIRECT_URL'] = __PS_BASE_URI__ . 'p/' . Image::getImgFolderStatic($matches[0]) . '/' . $matches[0] . '-' . $matches[1] . '.jpg';
}
}
if (preg_match('#/p[0-9/]*/([0-9]+)\\-([_a-zA-Z]*)\\.(png|jpe?g|gif)$#', $_SERVER['REDIRECT_URL'], $matches)) {
// Backward compatibility since we suffixed the template image with _default
if (Tools::strtolower(substr($matches[2], -8)) != '_default') {
header('Location: ' . $this->context->link->getImageLink('', $matches[1], $matches[2]), true, 302);
exit;
} else {
$image_type = ImageType::getByNameNType($matches[2], 'products');
if ($image_type && count($image_type)) {
$root = _PS_PROD_IMG_DIR_;
$folder = Image::getImgFolderStatic($matches[1]);
$file = $matches[1];
$ext = '.' . $matches[3];
if (file_exists($root . $folder . $file . $ext)) {
if (ImageManager::resize($root . $folder . $file . $ext, $root . $folder . $file . '-' . $matches[2] . $ext, (int) $image_type['width'], (int) $image_type['height'])) {
header('HTTP/1.1 200 Found');
header('Status: 200 Found');
header('Content-Type: image/jpg');
readfile($root . $folder . $file . '-' . $matches[2] . $ext);
exit;
}
}
}
}
} elseif (preg_match('#/c/([0-9]+)\\-([_a-zA-Z]*)\\.(png|jpe?g|gif)$#', $_SERVER['REDIRECT_URL'], $matches)) {
$image_type = ImageType::getByNameNType($matches[2], 'categories');
if ($image_type && count($image_type)) {
$root = _PS_CAT_IMG_DIR_;
$file = $matches[1];
$ext = '.' . $matches[3];
if (file_exists($root . $file . $ext)) {
if (ImageManager::resize($root . $file . $ext, $root . $file . '-' . $matches[2] . $ext, (int) $image_type['width'], (int) $image_type['height'])) {
header('HTTP/1.1 200 Found');
header('Status: 200 Found');
header('Content-Type: image/jpg');
readfile($root . $file . '-' . $matches[2] . $ext);
exit;
}
}
}
}
header('Content-Type: image/gif');
readfile(_PS_IMG_DIR_ . '404.gif');
exit;
} elseif (in_array(Tools::strtolower(substr($_SERVER['REQUEST_URI'], -3)), array('.js', 'css'))) {
$this->context->cookie->disallowWriting();
exit;
}
parent::initContent();
$this->setTemplate(_PS_THEME_DIR_ . '404.tpl');
}
示例9: installPicturesSettings
public static function installPicturesSettings($module)
{
// Default
if ($default = ImageType::getByNameNType('medium', 'products')) {
$sizeMedium = (int) $default['id_image_type'];
} else {
if ($medium = ImageType::getByNameNType('medium_default', 'products')) {
$sizeMedium = (int) $default['id_image_type'];
} else {
$sizeMedium = 0;
}
}
// Small
if ($small = ImageType::getByNameNType('small', 'products')) {
$sizeSmall = (int) $small['id_image_type'];
} else {
if ($small = ImageType::getByNameNType('small_default', 'products')) {
$sizeSmall = (int) $small['id_image_type'];
} else {
$sizeSmall = 0;
}
}
// Large
if ($large = ImageType::getByNameNType('large', 'products')) {
$sizeBig = (int) $large['id_image_type'];
} else {
if ($large = ImageType::getByNameNType('large_default', 'products')) {
$sizeBig = (int) $large['id_image_type'];
} else {
$sizeBig = 0;
}
}
$module->setConfiguration('EBAY_PICTURE_SIZE_DEFAULT', $sizeMedium);
$module->setConfiguration('EBAY_PICTURE_SIZE_SMALL', $sizeSmall);
$module->setConfiguration('EBAY_PICTURE_SIZE_BIG', $sizeBig);
}
示例10: initFormImages
/**
* @param Store $obj
* @throws Exception
* @throws SmartyException
*/
public function initFormImages($obj)
{
if ((bool) $obj->id) {
$count_images = Db::getInstance()->getValue('
SELECT COUNT(id_shop)
FROM ' . _DB_PREFIX_ . 'store_image
WHERE id_shop = ' . (int) $obj->id_shop);
$images = AphStoreImage::getImages($this->context->language->id, $obj->id_shop);
foreach ($images as $k => $image) {
$images[$k] = new AphStoreImage($image['id_image']);
}
$language = Language::getLanguage(Configuration::get('PS_LANG_DEFAULT'));
$image_uploader = new HelperImageUploader('file');
$image_uploader->setTemplateDirectory($this->tpl_dir . 'helpers/uploader/')->setMultiple(!(Tools::getUserBrowser() == 'Apple Safari' && Tools::getUserPlatform() == 'Windows'))->setUseAjax(true)->setUrl(Context::getContext()->link->getAdminLink('AdminAphStores') . '&ajax=1&id_store=' . (int) $obj->id . '&action=addStoreImage')->setTemplate('ajax.tpl');
$this->context->smarty->assign(array('iso_lang' => $language['iso_code'], 'token' => $this->token, 'table' => $this->table, 'countImages' => $count_images, 'images' => $images, 'max_image_size' => $this->max_image_size / 1024 / 1024, "image_uploader" => $image_uploader->render(), 'table' => $this->table, 'default_language' => (int) Configuration::get('PS_LANG_DEFAULT'), 'current_shop_id' => (int) $obj->id_shop, 'id_shop' => (int) $obj->id_shop, 'id_store' => (int) $obj->id));
$type = ImageType::getByNameNType('%', 'stores', 'height');
if (isset($type['name'])) {
$this->context->smarty->assign('imageType', $type['name']);
} else {
$this->context->smarty->assign('imageType', ImageType::getFormatedName('medium'));
}
}
}