本文整理汇总了PHP中cacheImage函数的典型用法代码示例。如果您正苦于以下问题:PHP cacheImage函数的具体用法?PHP cacheImage怎么用?PHP cacheImage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cacheImage函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cacheImage_protected
/**
* Provides an error protected cacheImage for PHP 5
*
*/
function cacheImage_protected($newfilename, $imgfile, $args, $allow_watermark = false, $theme, $album)
{
try {
cacheImage($newfilename, $imgfile, $args, $allow_watermark, $theme, $album);
return true;
} catch (Exception $e) {
debugLog('cacheImage(' . $newfilename . ') exception: ' . $e->getMessage());
return false;
}
}
示例2: displayListContent
public function displayListContent($token = NULL)
{
/* Display results in a table
*
* align : determine value alignment
* prefix : displayed before value
* suffix : displayed after value
* image : object image
* icon : icon determined by values
* active : allow to toggle status
*/
global $currentIndex, $cookie;
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$id_category = 1;
// default categ
$irow = 0;
if ($this->_list and isset($this->fieldsDisplay['position'])) {
$positions = array_map(create_function('$elem', 'return (int)($elem[\'position\']);'), $this->_list);
sort($positions);
}
if ($this->_list) {
$isCms = false;
if (preg_match('/cms/Ui', $this->identifier)) {
$isCms = true;
}
$keyToGet = 'id_' . ($isCms ? 'cms_' : '') . 'category' . (in_array($this->identifier, array('id_category', 'id_cms_category')) ? '_parent' : '');
foreach ($this->_list as $tr) {
$id = $tr[$this->identifier];
echo '<tr' . (array_key_exists($this->identifier, $this->identifiersDnd) ? ' id="tr_' . (($id_category = (int) Tools::getValue('id_' . ($isCms ? 'cms_' : '') . 'category', '1')) ? $id_category : '') . '_' . $id . '_' . $tr['position'] . '"' : '') . ($irow++ % 2 ? ' class="alt_row"' : '') . ' ' . ((isset($tr['color']) and $this->colorOnBackground) ? 'style="background-color: ' . $tr['color'] . '"' : '') . '>
<td class="center">';
if ($this->delete and (!isset($this->_listSkipDelete) or !in_array($id, $this->_listSkipDelete))) {
echo '<input type="checkbox" name="' . $this->table . 'Box[]" value="' . $id . '" class="noborder" />';
}
echo '</td>';
foreach ($this->fieldsDisplay as $key => $params) {
$tmp = explode('!', $key);
$key = isset($tmp[1]) ? $tmp[1] : $tmp[0];
echo '
<td ' . (isset($params['position']) ? ' id="td_' . (isset($id_category) and $id_category ? $id_category : 0) . '_' . $id . '"' : '') . ' class="' . ((!isset($this->noLink) or !$this->noLink) ? 'pointer' : '') . ((isset($params['position']) and $this->_orderBy == 'position') ? ' dragHandle' : '') . (isset($params['align']) ? ' ' . $params['align'] : '') . '" ';
if (!isset($params['position']) and (!isset($this->noLink) or !$this->noLink)) {
echo ' onclick="document.location = \'' . $currentIndex . '&' . $this->identifier . '=' . $id . ($this->view ? '&view' : '&update') . $this->table . '&token=' . ($token != NULL ? $token : $this->token) . '\'">' . (isset($params['prefix']) ? $params['prefix'] : '');
} else {
echo '>';
}
if (isset($params['active']) and isset($tr[$key])) {
$this->_displayEnableLink($token, $id, $tr[$key], $params['active'], Tools::getValue('id_category'), Tools::getValue('id_product'));
} elseif (isset($params['activeVisu']) and isset($tr[$key])) {
echo '<img src="../img/admin/' . ($tr[$key] ? 'enabled.gif' : 'disabled.gif') . '"
alt="' . ($tr[$key] ? $this->l('Enabled') : $this->l('Disabled')) . '" title="' . ($tr[$key] ? $this->l('Enabled') : $this->l('Disabled')) . '" />';
} elseif (isset($params['position'])) {
if ($this->_orderBy == 'position' and $this->_orderWay != 'DESC') {
echo '<a' . (!($tr[$key] != $positions[sizeof($positions) - 1]) ? ' style="display: none;"' : '') . ' href="' . $currentIndex . '&' . $keyToGet . '=' . (int) $id_category . '&' . $this->identifiersDnd[$this->identifier] . '=' . $id . '
&way=1&position=' . (int) ($tr['position'] + 1) . '&token=' . ($token != NULL ? $token : $this->token) . '">
<img src="../img/admin/' . ($this->_orderWay == 'ASC' ? 'down' : 'up') . '.gif"
alt="' . $this->l('Down') . '" title="' . $this->l('Down') . '" /></a>';
echo '<a' . (!($tr[$key] != $positions[0]) ? ' style="display: none;"' : '') . ' href="' . $currentIndex . '&' . $keyToGet . '=' . (int) $id_category . '&' . $this->identifiersDnd[$this->identifier] . '=' . $id . '
&way=0&position=' . (int) ($tr['position'] - 1) . '&token=' . ($token != NULL ? $token : $this->token) . '">
<img src="../img/admin/' . ($this->_orderWay == 'ASC' ? 'up' : 'down') . '.gif"
alt="' . $this->l('Up') . '" title="' . $this->l('Up') . '" /></a>';
} else {
echo (int) ($tr[$key] + 1);
}
} elseif (isset($params['image'])) {
// item_id is the product id in a product image context, else it is the image id.
$item_id = isset($params['image_id']) ? $tr[$params['image_id']] : $id;
// If it's a product image
if (isset($tr['id_image'])) {
$image = new Image((int) $tr['id_image']);
$path_to_image = _PS_IMG_DIR_ . $params['image'] . '/' . $image->getExistingImgPath() . '.' . $this->imageType;
} else {
$path_to_image = _PS_IMG_DIR_ . $params['image'] . '/' . $item_id . (isset($tr['id_image']) ? '-' . (int) $tr['id_image'] : '') . '.' . $this->imageType;
}
echo cacheImage($path_to_image, $this->table . '_mini_' . $item_id . '.' . $this->imageType, 45, $this->imageType);
} elseif (isset($params['icon']) and (isset($params['icon'][$tr[$key]]) or isset($params['icon']['default']))) {
echo '<img src="../img/admin/' . (isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default'] . '" alt="' . $tr[$key]) . '" title="' . $tr[$key] . '" />';
} elseif (isset($params['price'])) {
echo Tools::displayPrice($tr[$key], isset($params['currency']) ? Currency::getCurrencyInstance((int) $tr['id_currency']) : $currency, false);
} elseif (isset($params['float'])) {
echo rtrim(rtrim($tr[$key], '0'), '.');
} elseif (isset($params['type']) and $params['type'] == 'date') {
echo Tools::displayDate($tr[$key], (int) $cookie->id_lang);
} elseif (isset($params['type']) and $params['type'] == 'datetime') {
echo Tools::displayDate($tr[$key], (int) $cookie->id_lang, true);
} elseif (isset($tr[$key])) {
$echo = $key == 'price' ? round($tr[$key], 2) : isset($params['maxlength']) ? Tools::substr($tr[$key], 0, $params['maxlength']) . '...' : $tr[$key];
echo isset($params['callback']) ? call_user_func_array(array($this->className, $params['callback']), array($echo, $tr)) : $echo;
} else {
echo '--';
}
echo (isset($params['suffix']) ? $params['suffix'] : '') . '</td>';
}
if ($this->edit or $this->delete or $this->view and $this->view !== 'noActionColumn') {
echo '<td class="center" style="white-space: nowrap;">';
if ($this->view) {
$this->_displayViewLink($token, $id);
}
if ($this->edit) {
$this->_displayEditLink($token, $id);
}
if ($this->delete and (!isset($this->_listSkipDelete) or !in_array($id, $this->_listSkipDelete))) {
//.........这里部分代码省略.........
示例3: displayListContent
public function displayListContent($token = NULL)
{
/* Display results in a table
*
* align : determine value alignment
* prefix : displayed before value
* suffix : displayed after value
* image : object image
* icon : icon determined by values
* active : allow to toggle status
*/
global $currentIndex, $cookie;
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$_cacheLang['View'] = $this->l('View');
$_cacheLang['Edit'] = $this->l('Edit');
$_cacheLang['Delete'] = $this->l('Delete', __CLASS__, TRUE, FALSE);
$_cacheLang['DeleteItem'] = $this->l('Delete item #', __CLASS__, TRUE, FALSE);
$_cacheLang['Duplicate'] = $this->l('Duplicate');
$_cacheLang['Copy images too?'] = $this->l('Copy images too?', __CLASS__, TRUE, FALSE);
$irow = 0;
if ($this->_list and isset($this->fieldsDisplay['position'])) {
$positions = array_map(create_function('$elem', 'return intval($elem[\'position\']);'), $this->_list);
sort($positions);
}
if ($this->_list) {
foreach ($this->_list as $i => $tr) {
$id = $tr[$this->identifier];
echo '<tr' . ($this->identifier == 'id_product' ? ' id="tr_' . (($id_category = intval(Tools::getValue('id_category', '1'))) ? $id_category : '') . '_' . $id . '_' . $tr['position'] . '"' : '') . ($irow++ % 2 ? ' class="alt_row"' : '') . ' ' . ((isset($tr['color']) and $this->colorOnBackground) ? 'style="background-color: ' . $tr['color'] . '"' : '') . '>
<td class="center">';
if ($this->delete and (!isset($this->_listSkipDelete) or !in_array($id, $this->_listSkipDelete))) {
echo '<input type="checkbox" name="' . $this->table . 'Box[]" value="' . $id . '" class="noborder" />';
}
echo '</td>';
foreach ($this->fieldsDisplay as $key => $params) {
$tmp = explode('!', $key);
$key = isset($tmp[1]) ? $tmp[1] : $tmp[0];
echo '
<td ' . (isset($params['position']) ? ' id="td_' . (isset($id_category) and $id_category ? $id_category : 0) . '_' . $id . '"' : '') . ' class="pointer' . ((isset($params['position']) and $this->_orderBy == 'position') ? ' dragHandle' : '') . (isset($params['align']) ? ' ' . $params['align'] : '') . '" ';
if (!isset($params['position'])) {
echo ' onclick="document.location = \'' . $currentIndex . '&' . $this->identifier . '=' . $id . ($this->view ? '&view' : '&update') . $this->table . '&token=' . ($token != NULL ? $token : $this->token) . '\'">' . (isset($params['prefix']) ? $params['prefix'] : '');
} else {
echo '>';
}
if (isset($params['active']) and isset($tr[$key])) {
echo '<a href="' . $currentIndex . '&' . $this->identifier . '=' . $id . '&' . $params['active'] . (($id_category = intval(Tools::getValue('id_category')) and Tools::getValue('id_product')) ? '&id_category=' . $id_category : '') . '&token=' . ($token != NULL ? $token : $this->token) . '">
<img src="../img/admin/' . ($tr[$key] ? 'enabled.gif' : 'disabled.gif') . '"
alt="' . ($tr[$key] ? $this->l('Enabled') : $this->l('Disabled')) . '" title="' . ($tr[$key] ? $this->l('Enabled') : $this->l('Disabled')) . '" /></a>';
} elseif (isset($params['activeVisu']) and isset($tr[$key])) {
echo '<img src="../img/admin/' . ($tr[$key] ? 'enabled.gif' : 'disabled.gif') . '"
alt="' . ($tr[$key] ? $this->l('Enabled') : $this->l('Disabled')) . '" title="' . ($tr[$key] ? $this->l('Enabled') : $this->l('Disabled')) . '" />';
} elseif (isset($params['position'])) {
if ($this->_orderBy == 'position') {
echo '<a' . (!($tr[$key] != $positions[sizeof($positions) - 1]) ? ' style="display: none;"' : '') . ' href="' . $currentIndex . '&' . $this->identifier . '=' . $id . '&way=1&position=' . intval($tr['position'] + 1) . ($id_category = intval(Tools::getValue('id_category', 1)) ? '&id_category=' . $id_category : '') . '&token=' . ($token != NULL ? $token : $this->token) . '">
<img src="../img/admin/' . ($this->_orderWay == 'ASC' ? 'down' : 'up') . '.gif"
alt="' . $this->l('Down') . '" title="' . $this->l('Down') . '" /></a>';
echo '<a' . (!($tr[$key] != $positions[0]) ? ' style="display: none;"' : '') . ' href="' . $currentIndex . '&' . $this->identifier . '=' . $id . '&way=0&position=' . intval($tr['position'] - 1) . ($id_category = intval(Tools::getValue('id_category', 1)) ? '&id_category=' . $id_category : '') . '&token=' . ($token != NULL ? $token : $this->token) . '">
<img src="../img/admin/' . ($this->_orderWay == 'ASC' ? 'up' : 'down') . '.gif"
alt="' . $this->l('Up') . '" title="' . $this->l('Up') . '" /></a>';
} else {
echo intval($tr[$key] + 1);
}
} elseif (isset($params['image'])) {
$image_id = isset($params['image_id']) ? $tr[$params['image_id']] : $id;
echo cacheImage(_PS_IMG_DIR_ . $params['image'] . '/' . $image_id . (isset($tr['id_image']) ? '-' . intval($tr['id_image']) : '') . '.' . $this->imageType, $this->table . '_mini_' . $image_id . '.' . $this->imageType, 45, $this->imageType);
} elseif (isset($params['icon']) and (isset($params['icon'][$tr[$key]]) or isset($params['icon']['default']))) {
echo '<img src="../img/admin/' . (isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default'] . '" alt="' . $tr[$key]) . '" title="' . $tr[$key] . '" />';
} elseif (isset($params['price'])) {
echo Tools::displayPrice($tr[$key], isset($params['currency']) ? new Currency(intval($tr['id_currency'])) : $currency, false, false);
} elseif (isset($params['float'])) {
echo rtrim(rtrim($tr[$key], '0'), '.');
} elseif (isset($params['type']) and $params['type'] == 'date') {
echo Tools::displayDate($tr[$key], $cookie->id_lang);
} elseif (isset($params['type']) and $params['type'] == 'datetime') {
echo Tools::displayDate($tr[$key], $cookie->id_lang, true);
} elseif (isset($tr[$key])) {
$echo = $key == 'price' ? round($tr[$key], 2) : isset($params['maxlength']) ? Tools::substr($tr[$key], 0, $params['maxlength']) . '...' : $tr[$key];
echo isset($params['callback']) ? call_user_func_array(array($this->className, $params['callback']), array($echo, $tr)) : $echo;
} else {
echo '--';
}
echo (isset($params['suffix']) ? $params['suffix'] : '') . '</td>';
}
if ($this->edit or $this->delete or $this->view and $this->view !== 'noActionColumn') {
echo '<td class="center" style="white-space: nowrap;">';
if ($this->view) {
echo '
<a href="' . $currentIndex . '&' . $this->identifier . '=' . $id . '&view' . $this->table . '&token=' . ($token != NULL ? $token : $this->token) . '">
<img src="../img/admin/details.gif" alt="' . $_cacheLang['View'] . '" title="' . $_cacheLang['View'] . '" /></a>';
}
if ($this->edit) {
echo '
<a href="' . $currentIndex . '&' . $this->identifier . '=' . $id . '&update' . $this->table . '&token=' . ($token != NULL ? $token : $this->token) . '">
<img src="../img/admin/edit.gif" alt="" title="' . $_cacheLang['Edit'] . '" /></a>';
}
if ($this->delete and (!isset($this->_listSkipDelete) or !in_array($id, $this->_listSkipDelete))) {
echo '
<a href="' . $currentIndex . '&' . $this->identifier . '=' . $id . '&delete' . $this->table . '&token=' . ($token != NULL ? $token : $this->token) . '" onclick="return confirm(\'' . $_cacheLang['DeleteItem'] . $id . ' ?\');">
<img src="../img/admin/delete.gif" alt="' . $_cacheLang['Delete'] . '" title="' . $_cacheLang['Delete'] . '" /></a>';
}
$duplicate = $currentIndex . '&' . $this->identifier . '=' . $id . '&duplicate' . $this->table;
//.........这里部分代码省略.........
示例4: displayCustomizedDatas
private function displayCustomizedDatas(&$customizedDatas, &$product, &$currency, &$image, $tokenCatalog, &$stock)
{
if (!($order = $this->loadObject(true))) {
return;
}
if (is_array($customizedDatas) and isset($customizedDatas[(int) $product['id_product']][(int) $product['id_product_attribute']])) {
if ($image = new Image($image['id_image'])) {
echo '
<tr>
<td align="center">' . (isset($image->id_image) ? cacheImage(_PS_IMG_DIR_ . 'p/' . $image->getExistingImgPath() . '.jpg', 'product_mini_' . (int) $product['id_product'] . (isset($product['id_product_attribute']) ? '_' . (int) $product['id_product_attribute'] : '') . '.jpg', 45, 'jpg') : '--') . '</td>
<td><a href="index.php?tab=AdminCatalog&id_product=' . $product['id_product'] . '&updateproduct&token=' . $tokenCatalog . '">
<span class="productName">' . $product['name'] . '</span>' . (isset($product['attributes']) ? '<br />' . $product['attributes'] : '') . '<br />
' . ($product['reference'] ? $this->l('Ref:') . ' ' . $product['reference'] : '') . (($product['reference'] and $product['supplier_reference']) ? ' / ' . $product['supplier_reference'] : '') . '</a></td>
<td align="center">' . Tools::displayPrice($product['price_wt'], $currency, false) . '</td>
<td align="center" class="productQuantity">' . $product['customizationQuantityTotal'] . '</td>
<td align="center" class="productQuantity">' . (int) $stock['quantity'] . '</td>
<td align="right">' . Tools::displayPrice($product['total_customization_wt'], $currency, false) . '</td>
</tr>';
}
foreach ($customizedDatas[(int) $product['id_product']][(int) $product['id_product_attribute']] as $customization) {
echo '
<tr>
<td colspan="2">';
foreach ($customization['datas'] as $type => $datas) {
if ($type == _CUSTOMIZE_FILE_) {
$i = 0;
echo '<ul style="margin: 0; padding: 0; list-style-type: none;">';
foreach ($datas as $data) {
echo '<li style="display: inline; margin: 2px;">
<a href="displayImage.php?img=' . $data['value'] . '&name=' . (int) $order->id . '-file' . ++$i . '" target="_blank"><img src="' . _THEME_PROD_PIC_DIR_ . $data['value'] . '_small" alt="" /></a>
</li>';
}
echo '</ul>';
} elseif ($type == _CUSTOMIZE_TEXTFIELD_) {
$i = 0;
echo '<ul style="margin-bottom: 4px; padding: 0; list-style-type: none;">';
foreach ($datas as $data) {
echo '<li>' . ($data['name'] ? $data['name'] : $this->l('Text #') . ++$i) . $this->l(':') . ' <b>' . $data['value'] . '</b></li>';
}
echo '</ul>';
}
}
echo '</td>
<td align="center"></td>
<td align="center" class="productQuantity">' . $customization['quantity'] . '</td>
<td align="center" class="productQuantity"></td>
<td align="center"></td>
</tr>';
}
}
}
示例5: displayListContent
public function displayListContent($token = NULL)
{
global $currentIndex;
$irow = 0;
if ($this->_list) {
foreach ($this->_list as $tr) {
$id = $tr[$this->identifier];
if ($tr['active']) {
$active['title'] = "Enabled";
$active['img'] = "enabled";
if (!Language::checkFilesWithIsoCode($tr['iso_code'])) {
$active['title'] = "Warning, some translations files are missing for that iso-code";
$active['img'] = "warning";
}
} else {
$active['title'] = "Disabled";
$active['img'] = "disabled";
}
echo '<tr' . ($irow++ % 2 ? ' class="alt_row"' : '') . ' ' . ((isset($tr['color']) and $this->colorOnBackground) ? 'style="background-color: ' . $tr['color'] . '"' : '') . '>';
echo '<td class="center"><input type="checkbox" name="' . $this->table . 'Box[]" value="' . $id . '" class="noborder" /></td>';
foreach ($this->fieldsDisplay as $key => $params) {
$tmp = explode('!', $key);
$key = isset($tmp[1]) ? $tmp[1] : $tmp[0];
echo '<td class="pointer ' . (isset($params['align']) ? $params['align'] : '') . '" onclick="document.location = \'' . $currentIndex . '&' . $this->identifier . '=' . $id . '&update' . $this->table . '&token=' . ($token != NULL ? $token : $this->token) . '\'">';
if (isset($params['active']) and isset($tr[$key])) {
echo '<a href="' . $currentIndex . '&' . $this->identifier . '=' . $id . '&' . $params['active'] . '&token=' . ($token != NULL ? $token : $this->token) . '"><img src="../img/admin/' . $active['img'] . '.gif" alt="active" title="' . $active['title'] . '" /></a>';
} elseif (isset($params['image'])) {
echo cacheImage(_PS_IMG_DIR_ . $params['image'] . '/' . $id . (isset($tr['id_image']) ? '-' . (int) $tr['id_image'] : '') . '.' . $this->imageType, $this->table . '_mini_' . $id . '.' . $this->imageType, 45, $this->imageType);
} elseif (isset($tr[$key])) {
echo $tr[$key];
} else {
echo '--';
}
'</td>';
}
if ($this->edit or $this->delete or $this->view and $this->view !== 'noActionColumn') {
echo '<td class="center">';
if ($this->edit) {
echo '
<a href="' . $currentIndex . '&' . $this->identifier . '=' . $id . '&update' . $this->table . '&token=' . ($token != NULL ? $token : $this->token) . '">
<img src="../img/admin/edit.gif" border="0" alt="' . $this->l('Edit') . '" title="' . $this->l('Edit') . '" /></a>';
}
if ($this->delete) {
echo '
<a href="' . $currentIndex . '&' . $this->identifier . '=' . $id . '&delete' . $this->table . '&token=' . ($token != NULL ? $token : $this->token) . '" onclick="return confirm(\'' . $this->l('When you delete a language, ALL RELATED TRANSLATIONS IN THE DATABASE WILL BE DELETED, are you sure you want to delete this language?', __CLASS__, true, false) . '\');">
<img src="../img/admin/delete.gif" border="0" alt="' . $this->l('Delete') . '" title="' . $this->l('Delete') . '" /></a>';
}
echo '</td>';
}
echo '</tr>';
}
}
}
示例6: episode_info
function episode_info($show, $episode_num, $isShow, $epiInfo)
{
$temp = explode('x', $episode_num);
$episode = $show->getEpisode($temp[0], $temp[1]);
_debug(print_r($episode, TRUE));
$name = $show->seriesName;
$episode_name = $episode->name;
$text = empty($episode->overview) ? $show->overview : $episode->overview;
$image = empty($episode->filename) ? '' : cacheImage('http://thetvdb.com/banners/' . $episode->filename);
$rating = $show->rating;
$airdate = date('M d, Y', $episode->firstAired);
$actors = array();
if ($episode->guestStars) {
foreach ($episode->guestStars as $person_name) {
$guests[] = $person_name;
}
}
if ($show->actors) {
foreach ($show->actors as $person_name) {
$actors[] = $person_name;
}
}
$directors = array();
if ($episode->directors) {
foreach ($episode->directors as $person_name) {
$directors[] = $person_name;
}
}
$writers = array();
if ($episode->writers) {
foreach ($episode->writers as $person_name) {
$writers[] = $person_name;
}
}
ob_start();
require 'templates/episode.tpl';
return ob_get_contents();
ob_end_clean();
}
示例7: viewDetails
//.........这里部分代码省略.........
$image = array();
if (isset($product['product_attribute_id']) and (int) $product['product_attribute_id']) {
$image = Db::getInstance()->getRow('
SELECT id_image
FROM ' . _DB_PREFIX_ . 'product_attribute_image
WHERE id_product_attribute = ' . (int) $product['product_attribute_id']);
}
if (!isset($image['id_image']) or !$image['id_image']) {
$image = Db::getInstance()->getRow('
SELECT id_image
FROM ' . _DB_PREFIX_ . 'image
WHERE id_product = ' . (int) $product['product_id'] . ' AND cover = 1');
}
$stock = Db::getInstance()->getRow('
SELECT ' . ($product['product_attribute_id'] ? 'pa' : 'p') . '.quantity
FROM ' . _DB_PREFIX_ . 'product p
' . ($product['product_attribute_id'] ? 'LEFT JOIN ' . _DB_PREFIX_ . 'product_attribute pa ON p.id_product = pa.id_product' : '') . '
WHERE p.id_product = ' . (int) $product['product_id'] . '
' . ($product['product_attribute_id'] ? 'AND pa.id_product_attribute = ' . (int) $product['product_attribute_id'] : ''));
if (isset($image['id_image'])) {
$target = _PS_TMP_IMG_DIR_ . 'product_mini_' . (int) $product['product_id'] . (isset($product['product_attribute_id']) ? '_' . (int) $product['product_attribute_id'] : '') . '.jpg';
if (file_exists($target)) {
$products[$k]['image_size'] = getimagesize($target);
}
}
// Customization display
$this->displayCustomizedDatas($customizedDatas, $product, $currency, $image, $tokenCatalog, $k);
// Normal display
if ($product['product_quantity'] > $product['customizationQuantityTotal']) {
$quantity = $product['product_quantity'] - $product['customizationQuantityTotal'];
$imageObj = new Image($image['id_image']);
echo '
<tr' . ((isset($image['id_image']) and isset($products[$k]['image_size'])) ? ' height="' . ($products[$k]['image_size'][1] + 7) . '"' : '') . '>
<td align="center">' . (isset($image['id_image']) ? cacheImage(_PS_IMG_DIR_ . 'p/' . $imageObj->getExistingImgPath() . '.jpg', 'product_mini_' . (int) $product['product_id'] . (isset($product['product_attribute_id']) ? '_' . (int) $product['product_attribute_id'] : '') . '.jpg', 45, 'jpg') : '--') . '</td>
<td><a href="index.php?tab=AdminCatalog&id_product=' . $product['product_id'] . '&updateproduct&token=' . $tokenCatalog . '">
<span class="productName">' . $product['product_name'] . '</span><br />
' . ($product['product_reference'] ? $this->l('Ref:') . ' ' . $product['product_reference'] . '<br />' : '') . ($product['product_supplier_reference'] ? $this->l('Ref Supplier:') . ' ' . $product['product_supplier_reference'] : '') . '</a></td>
<td align="center">' . Tools::displayPrice($product_price, $currency, false) . '</td>
<td align="center" class="productQuantity" ' . ($quantity > 1 ? 'style="font-weight:700;font-size:1.1em;color:red"' : '') . '>' . (int) $quantity . '</td>
' . ($order->hasBeenPaid() ? '<td align="center" class="productQuantity">' . (int) $product['product_quantity_refunded'] . '</td>' : '') . '
' . ($order->hasBeenDelivered() ? '<td align="center" class="productQuantity">' . (int) $product['product_quantity_return'] . '</td>' : '') . '
<td align="center" class="productQuantity">' . (int) $stock['quantity'] . '</td>
<td align="center">' . Tools::displayPrice(Tools::ps_round($product_price, 2) * ((int) $product['product_quantity'] - $product['customizationQuantityTotal']), $currency, false) . '</td>
<td align="center" class="cancelCheck">
<input type="hidden" name="totalQtyReturn" id="totalQtyReturn" value="' . (int) $product['product_quantity_return'] . '" />
<input type="hidden" name="totalQty" id="totalQty" value="' . (int) $product['product_quantity'] . '" />
<input type="hidden" name="productName" id="productName" value="' . $product['product_name'] . '" />';
if ((!$order->hasBeenDelivered() or Configuration::get('PS_ORDER_RETURN')) and (int) $product['product_quantity_return'] < (int) $product['product_quantity']) {
echo '
<input type="checkbox" name="id_order_detail[' . $k . ']" id="id_order_detail[' . $k . ']" value="' . $product['id_order_detail'] . '" onchange="setCancelQuantity(this, ' . (int) $product['id_order_detail'] . ', ' . (int) ($product['product_quantity_in_stock'] - $product['customizationQuantityTotal'] - $product['product_quantity_reinjected']) . ')" ' . ((int) ($product['product_quantity_return'] + $product['product_quantity_refunded']) >= (int) $product['product_quantity'] ? 'disabled="disabled" ' : '') . '/>';
} else {
echo '--';
}
echo '
</td>
<td class="cancelQuantity">';
if ((int) ($product['product_quantity_return'] + $product['product_quantity_refunded']) >= (int) $product['product_quantity']) {
echo '<input type="hidden" name="cancelQuantity[' . $k . ']" value="0" />';
} elseif (!$order->hasBeenDelivered() or Configuration::get('PS_ORDER_RETURN')) {
echo '
<input type="text" id="cancelQuantity_' . (int) $product['id_order_detail'] . '" name="cancelQuantity[' . $k . ']" size="2" onclick="selectCheckbox(this);" value="" /> ';
}
echo $this->getCancelledProductNumber($order, $product) . '
</td>
</tr>';
}
示例8: debugLog
if (file_exists($newfile) & !$adminrequest) {
if (filemtime($newfile) >= filemtime($imgfile)) {
$process = false;
if (DEBUG_IMAGE) {
debugLog("Cache file valid");
}
}
}
if ($process) {
// If the file hasn't been cached yet, create it.
if ($forbidden) {
imageError('403 Forbidden', gettext("Forbidden(2)"));
}
$iMutex = new zpMutex('i', getOption('imageProcessorConcurrency'));
$iMutex->lock();
$result = cacheImage($newfilename, $imgfile, $args, $allowWatermark, $theme, $album);
$iMutex->unlock();
if (!$result) {
imageError('404 Not Found', sprintf(gettext('Image processing of %s resulted in a fatal error.'), filesystemToInternal($image)));
}
$fmt = filemtime($newfile);
}
$protocol = FULLWEBPATH;
$path = $protocol . '/' . CACHEFOLDER . pathurlencode(imgSrcURI($newfilename));
if (!$debug) {
// ... and redirect the browser to it.
$suffix = getSuffix($newfilename);
switch ($suffix) {
case 'wbm':
case 'wbmp':
$suffix = 'wbmp';
示例9: getImageURL
}
$selectedImage = $images["photo"][$rndID];
$selectedImage["url"] = getImageURL($selectedImage, $w, $h);
$selectedImage["licensename"] = getImageLicense($selectedImage);
$selectedImage["fulltitle"] = $selectedImage["title"] . " by " . $selectedImage["ownername"];
}
if (!isset($selectedImage)) {
$selectedImage["url"] = $site["flickr"]["defaultImage"];
$selectedImage["licensename"] = $site["flickr"]["defaultLicense"];
$selectedImage["fulltitle"] = $site["flickr"]["defaultFullTitle"];
}
$selectedImage["md5"] = md5($selectedImage["url"]);
$selectedImage["cached"] = $site["imageCache"] . $selectedImage["md5"] . ".jpg";
$selectedImage["cachedresized"] = $site["path"] . $site["folder"] . $site["imageCache"] . $selectedImage["md5"] . "." . $w . "." . $h . ".jpg";
$selectedImage["cachedresizedpublic"] = $site["folder"] . $site["imageCache"] . $selectedImage["md5"] . "." . $w . "." . $h . ".jpg";
cacheImage($selectedImage["url"], $selectedImage["cached"]);
smart_resize_image($selectedImage["cached"], null, $w, $h, false, $selectedImage["cachedresized"], true);
//Convert image to jpg
$img = $selectedImage["cachedresized"];
$img_info = getimagesize($img);
$width = $img_info[0];
$height = $img_info[1];
$convert = false;
switch ($img_info[2]) {
case IMAGETYPE_GIF:
$src = imagecreatefromgif($img);
$convert = true;
break;
case IMAGETYPE_PNG:
$src = imagecreatefrompng($img);
$convert = true;
示例10: filemtime
}
}
}
}
$process = true;
// If the file exists, check its modification time and update as needed.
$fmt = filemtime($imgfile);
if (file_exists($newfile) & !$adminrequest) {
if (filemtime($newfile) >= filemtime($imgfile)) {
$process = false;
}
}
// If the file hasn't been cached yet, create it.
if ($process) {
// setup standard image options from the album theme if it exists
cacheImage($newfilename, $imgfile, $args, $allowWatermark, false, $theme);
}
if (!$debug) {
// ... and redirect the browser to it.
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $fmt) . ' GMT');
header('Content-Type: image/jpeg');
header('Location: ' . FULLWEBPATH . substr(CACHEFOLDER, 0, -1) . pathurlencode(imgSrcURI($newfilename)), true, 301);
exit;
} else {
echo "\n<p>Image: <img src=\"" . FULLWEBPATH . substr(CACHEFOLDER, 0, -1) . pathurlencode(imgSrcURI($newfilename)) . "\" /></p>";
}
////////////////////////////////////////////////////////////////////////////////
function themeSetup($album)
{
// a real hack--but we need to conserve memory in i.php so loading the classes is out of the question.
$theme = getOption('current_theme');