當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ImageManager::thumbnail方法代碼示例

本文整理匯總了PHP中ImageManager::thumbnail方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImageManager::thumbnail方法的具體用法?PHP ImageManager::thumbnail怎麽用?PHP ImageManager::thumbnail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ImageManager的用法示例。


在下文中一共展示了ImageManager::thumbnail方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: renderForm

 public function renderForm()
 {
     // loads current warehouse
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $image = _PS_SUPP_IMG_DIR_ . $obj->id . '.jpg';
     $image_url = ImageManager::thumbnail($image, $this->table . '_' . (int) $obj->id . '.' . $this->imageType, 350, $this->imageType, true, true);
     $image_size = file_exists($image) ? filesize($image) / 1000 : false;
     $tmp_addr = new Address();
     $res = $tmp_addr->getFieldsRequiredDatabase();
     $required_fields = array();
     foreach ($res as $row) {
         $required_fields[(int) $row['id_required_field']] = $row['field_name'];
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Suppliers'), 'icon' => 'icon-truck'), 'input' => array(array('type' => 'hidden', 'name' => 'id_address'), array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'required' => true, 'col' => 4, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), in_array('company', $required_fields) ? array('type' => 'text', 'label' => $this->l('Company'), 'name' => 'company', 'display' => in_array('company', $required_fields), 'required' => in_array('company', $required_fields), 'maxlength' => 16, 'col' => 4, 'hint' => $this->l('Company name for this supplier')) : null, array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'description', 'lang' => true, 'hint' => array($this->l('Invalid characters:') . ' <>;=#{}', $this->l('Will appear in the list of suppliers.')), 'autoload_rte' => 'rte'), array('type' => 'text', 'label' => $this->l('Phone'), 'name' => 'phone', 'required' => in_array('phone', $required_fields), 'maxlength' => 16, 'col' => 4, 'hint' => $this->l('Phone number for this supplier')), array('type' => 'text', 'label' => $this->l('Mobile phone'), 'name' => 'phone_mobile', 'required' => in_array('phone_mobile', $required_fields), 'maxlength' => 16, 'col' => 4, 'hint' => $this->l('Mobile phone number for this supplier.')), array('type' => 'text', 'label' => $this->l('Address'), 'name' => 'address', 'maxlength' => 128, 'col' => 6, 'required' => true), array('type' => 'text', 'label' => $this->l('Address') . ' (2)', 'name' => 'address2', 'required' => in_array('address2', $required_fields), 'col' => 6, 'maxlength' => 128), array('type' => 'text', 'label' => $this->l('Zip/postal code'), 'name' => 'postcode', 'required' => in_array('postcode', $required_fields), 'maxlength' => 12, 'col' => 2), array('type' => 'text', 'label' => $this->l('City'), 'name' => 'city', 'maxlength' => 32, 'col' => 4, 'required' => true), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => true, 'col' => 4, 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id, false), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'col' => 4, 'options' => array('id' => 'id_state', 'query' => array(), 'name' => 'name')), array('type' => 'file', 'label' => $this->l('Logo'), 'name' => 'logo', 'display_image' => true, 'image' => $image_url ? $image_url : false, 'size' => $image_size, 'hint' => $this->l('Upload a supplier logo from your computer.')), array('type' => 'text', 'label' => $this->l('Meta title'), 'name' => 'meta_title', 'lang' => true, 'col' => 4, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Meta description'), 'name' => 'meta_description', 'lang' => true, 'col' => 6, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'tags', 'label' => $this->l('Meta keywords'), 'name' => 'meta_keywords', 'lang' => true, 'col' => 6, 'hint' => array($this->l('To add "tags" click in the field, write something and then press "Enter".'), $this->l('Forbidden characters:') . ' <>;=#{}')), array('type' => 'switch', 'label' => $this->l('Enable'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l('Save')));
     // loads current address for this supplier - if possible
     $address = null;
     if (isset($obj->id)) {
         $id_address = Address::getAddressIdBySupplierId($obj->id);
         if ($id_address > 0) {
             $address = new Address((int) $id_address);
         }
     }
     // force specific fields values (address)
     if ($address != null) {
         $this->fields_value = array('id_address' => $address->id, 'phone' => $address->phone, 'phone_mobile' => $address->phone_mobile, 'address' => $address->address1, 'address2' => $address->address2, 'postcode' => $address->postcode, 'city' => $address->city, 'id_country' => $address->id_country, 'id_state' => $address->id_state);
     } else {
         $this->fields_value = array('id_address' => 0, 'id_country' => Configuration::get('PS_COUNTRY_DEFAULT'));
     }
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
     }
     return parent::renderForm();
 }
開發者ID:nmardones,項目名稱:PrestaShop,代碼行數:35,代碼來源:AdminSuppliersController.php

示例2: getContent

 /**
  * Returns the template's HTML content
  * @return string HTML content
  */
 public function getContent()
 {
     $delivery_address = new Address((int) $this->order->id_address_delivery);
     $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
     $formatted_invoice_address = '';
     if ($this->order->id_address_delivery != $this->order->id_address_invoice) {
         $invoice_address = new Address((int) $this->order->id_address_invoice);
         $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' ');
     }
     $carrier = new Carrier($this->order->id_carrier);
     $carrier->name = $carrier->name == '0' ? Configuration::get('PS_SHOP_NAME') : $carrier->name;
     $order_details = $this->order_invoice->getProducts();
     if (Configuration::get('PS_PDF_IMG_DELIVERY')) {
         foreach ($order_details as &$order_detail) {
             if ($order_detail['image'] != null) {
                 $name = 'product_mini_' . (int) $order_detail['product_id'] . (isset($order_detail['product_attribute_id']) ? '_' . (int) $order_detail['product_attribute_id'] : '') . '.jpg';
                 $order_detail['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_ . 'p/' . $order_detail['image']->getExistingImgPath() . '.jpg', $name, 45, 'jpg', false);
                 if (file_exists(_PS_TMP_IMG_DIR_ . $name)) {
                     $order_detail['image_size'] = getimagesize(_PS_TMP_IMG_DIR_ . $name);
                 } else {
                     $order_detail['image_size'] = false;
                 }
             }
         }
     }
     $this->smarty->assign(array('order' => $this->order, 'order_details' => $order_details, 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'order_invoice' => $this->order_invoice, 'carrier' => $carrier));
     return $this->smarty->fetch($this->getTemplate('delivery-slip'));
 }
開發者ID:zangles,項目名稱:lennyba,代碼行數:32,代碼來源:HTMLTemplateDeliverySlip.php

示例3: renderForm

 public function renderForm()
 {
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $image = _PS_STORE_IMG_DIR_ . $obj->id . '.jpg';
     $image_url = ImageManager::thumbnail($image, $this->table . '_' . (int) $obj->id . '.' . $this->imageType, 350, $this->imageType, true, true);
     $image_size = file_exists($image) ? filesize($image) / 1000 : false;
     $tmp_addr = new Address();
     $res = $tmp_addr->getFieldsRequiredDatabase();
     $required_fields = array();
     foreach ($res as $row) {
         $required_fields[(int) $row['id_required_field']] = $row['field_name'];
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Stores'), 'icon' => 'icon-home'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'required' => false, 'hint' => array($this->l('Store name (e.g. City Center Mall Store).'), $this->l('Allowed characters: letters, spaces and %s'))), array('type' => 'text', 'label' => $this->l('Address'), 'name' => 'address1', 'required' => true), array('type' => 'text', 'label' => $this->l('Address (2)'), 'name' => 'address2'), array('type' => 'text', 'label' => $this->l('Zip/postal Code'), 'name' => 'postcode', 'required' => in_array('postcode', $required_fields)), array('type' => 'text', 'label' => $this->l('City'), 'name' => 'city', 'required' => true), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => true, 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'required' => true, 'options' => array('id' => 'id_state', 'name' => 'name', 'query' => null)), array('type' => 'latitude', 'label' => $this->l('Latitude / Longitude'), 'name' => 'latitude', 'required' => true, 'maxlength' => 12, 'hint' => $this->l('Store coordinates (e.g. 45.265469/-47.226478).')), array('type' => 'text', 'label' => $this->l('Phone'), 'name' => 'phone'), array('type' => 'text', 'label' => $this->l('Fax'), 'name' => 'fax'), array('type' => 'text', 'label' => $this->l('Email address'), 'name' => 'email'), array('type' => 'textarea', 'label' => $this->l('Note'), 'name' => 'note', 'cols' => 42, 'rows' => 4), array('type' => 'switch', 'label' => $this->l('Status'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'hint' => $this->l('Whether or not to display this store.')), array('type' => 'file', 'label' => $this->l('Picture'), 'name' => 'image', 'display_image' => true, 'image' => $image_url ? $image_url : false, 'size' => $image_size, 'hint' => $this->l('Storefront picture.'))), 'hours' => array(), 'submit' => array('title' => $this->l('Save')));
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
     }
     $days = array();
     $days[1] = $this->l('Monday');
     $days[2] = $this->l('Tuesday');
     $days[3] = $this->l('Wednesday');
     $days[4] = $this->l('Thursday');
     $days[5] = $this->l('Friday');
     $days[6] = $this->l('Saturday');
     $days[7] = $this->l('Sunday');
     $hours = $this->getFieldValue($obj, 'hours');
     if (!empty($hours)) {
         $hours_unserialized = Tools::unSerialize($hours);
     }
     $this->fields_value = array('latitude' => $this->getFieldValue($obj, 'latitude') ? $this->getFieldValue($obj, 'latitude') : Configuration::get('PS_STORES_CENTER_LAT'), 'longitude' => $this->getFieldValue($obj, 'longitude') ? $this->getFieldValue($obj, 'longitude') : Configuration::get('PS_STORES_CENTER_LONG'), 'days' => $days, 'hours' => isset($hours_unserialized) ? $hours_unserialized : false);
     return parent::renderForm();
 }
開發者ID:jpodracky,項目名稱:dogs,代碼行數:33,代碼來源:AdminStoresController.php

示例4: getContent

 /**
  * Returns the template's HTML content
  * @return string HTML content
  */
 public function getContent()
 {
     $invoice_address = new Address((int) $this->order->id_address_invoice);
     $country = new Country((int) $invoice_address->id_country);
     $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' ');
     $formatted_delivery_address = '';
     if ($this->order->id_address_delivery != $this->order->id_address_invoice) {
         $delivery_address = new Address((int) $this->order->id_address_delivery);
         $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
     }
     $customer = new Customer((int) $this->order->id_customer);
     $order_details = $this->order_invoice->getProducts();
     if (Configuration::get('PS_PDF_IMG_INVOICE')) {
         foreach ($order_details as &$order_detail) {
             if ($order_detail['image'] != null) {
                 $name = 'product_mini_' . (int) $order_detail['product_id'] . (isset($order_detail['product_attribute_id']) ? '_' . (int) $order_detail['product_attribute_id'] : '') . '.jpg';
                 $order_detail['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_ . 'p/' . $order_detail['image']->getExistingImgPath() . '.jpg', $name, 45, 'jpg', false);
                 if (file_exists(_PS_TMP_IMG_DIR_ . $name)) {
                     $order_detail['image_size'] = getimagesize(_PS_TMP_IMG_DIR_ . $name);
                 } else {
                     $order_detail['image_size'] = false;
                 }
             }
         }
     }
     $data = array('order' => $this->order, 'order_details' => $order_details, 'cart_rules' => $this->order->getCartRules($this->order_invoice->id), 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'tax_excluded_display' => Group::getPriceDisplayMethod($customer->id_default_group), 'tax_tab' => $this->getTaxTabContent(), 'customer' => $customer);
     if (Tools::getValue('debug')) {
         die(json_encode($data));
     }
     $this->smarty->assign($data);
     return $this->smarty->fetch($this->getTemplateByCountry($country->iso_code));
 }
開發者ID:zangles,項目名稱:lennyba,代碼行數:36,代碼來源:HTMLTemplateInvoice.php

示例5: renderForm

 public function renderForm()
 {
     // loads current warehouse
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Suppliers'), 'image' => '../img/admin/suppliers.gif'), 'input' => array(array('type' => 'hidden', 'name' => 'id_address'), array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'size' => 40, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'textarea', 'label' => $this->l('Description:'), 'name' => 'description', 'cols' => 60, 'rows' => 10, 'lang' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('Will appear in the supplier list')), array('type' => 'text', 'label' => $this->l('Phone:'), 'name' => 'phone', 'size' => 15, 'maxlength' => 16, 'desc' => $this->l('Phone number for this supplier')), array('type' => 'text', 'label' => $this->l('Address:'), 'name' => 'address', 'size' => 100, 'maxlength' => 128, 'required' => true), array('type' => 'text', 'label' => $this->l('Address:') . ' (2)', 'name' => 'address2', 'size' => 100, 'maxlength' => 128), array('type' => 'text', 'label' => $this->l('Postal Code/Zip Code:'), 'name' => 'postcode', 'size' => 10, 'maxlength' => 12, 'required' => true), array('type' => 'text', 'label' => $this->l('City:'), 'name' => 'city', 'size' => 20, 'maxlength' => 32, 'required' => true), array('type' => 'select', 'label' => $this->l('Country:'), 'name' => 'id_country', 'required' => true, 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id, false), 'id' => 'id_country', 'name' => 'name'), 'desc' => $this->l('Country where the state, region or city is located')), array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'options' => array('id' => 'id_state', 'query' => array(), 'name' => 'name')), array('type' => 'file', 'label' => $this->l('Logo:'), 'name' => 'logo', 'display_image' => true, 'desc' => $this->l('Upload a supplier logo from your computer')), array('type' => 'text', 'label' => $this->l('Meta title:'), 'name' => 'meta_title', 'lang' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Meta description:'), 'name' => 'meta_description', 'lang' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'tags', 'label' => $this->l('Meta keywords:'), 'name' => 'meta_keywords', 'lang' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}', 'desc' => $this->l('To add "tags" click in the field, write something and then press "Enter"')), array('type' => 'radio', 'label' => $this->l('Enable:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l('   Save   '), 'class' => 'button'));
     // loads current address for this supplier - if possible
     $address = null;
     if (isset($obj->id)) {
         $id_address = Address::getAddressIdBySupplierId($obj->id);
         if ($id_address > 0) {
             $address = new Address((int) $id_address);
         }
     }
     // force specific fields values (address)
     if ($address != null) {
         $this->fields_value = array('id_address' => $address->id, 'phone' => $address->phone, 'address' => $address->address1, 'address2' => $address->address2, 'postcode' => $address->postcode, 'city' => $address->city, 'id_country' => $address->id_country, 'id_state' => $address->id_state);
     } else {
         $this->fields_value = array('id_address' => 0, 'id_country' => Configuration::get('PS_COUNTRY_DEFAULT'));
     }
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
     }
     // set logo image
     $image = ImageManager::thumbnail(_PS_SUPP_IMG_DIR_ . '/' . $this->object->id . '.jpg', $this->table . '_' . (int) $this->object->id . '.' . $this->imageType, 350, $this->imageType, true);
     $this->fields_value['image'] = $image ? $image : false;
     $this->fields_value['size'] = $image ? filesize(_PS_SUPP_IMG_DIR_ . '/' . $this->object->id . '.jpg') / 1000 : false;
     return parent::renderForm();
 }
開發者ID:FAVHYAN,項目名稱:a3workout,代碼行數:30,代碼來源:AdminSuppliersController.php

示例6: getContent

 /**
  * Returns the template's HTML content
  *
  * @return string HTML content
  */
 public function getContent()
 {
     $delivery_address = new Address((int) $this->order->id_address_delivery);
     $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
     $formatted_invoice_address = '';
     if ($this->order->id_address_delivery != $this->order->id_address_invoice) {
         $invoice_address = new Address((int) $this->order->id_address_invoice);
         $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' ');
     }
     $carrier = new Carrier($this->order->id_carrier);
     $carrier->name = $carrier->name == '0' ? Configuration::get('PS_SHOP_NAME') : $carrier->name;
     $order_details = $this->order_invoice->getProducts();
     if (Configuration::get('PS_PDF_IMG_DELIVERY')) {
         foreach ($order_details as &$order_detail) {
             if ($order_detail['image'] != null) {
                 $name = 'product_mini_' . (int) $order_detail['product_id'] . (isset($order_detail['product_attribute_id']) ? '_' . (int) $order_detail['product_attribute_id'] : '') . '.jpg';
                 $path = _PS_PROD_IMG_DIR_ . $order_detail['image']->getExistingImgPath() . '.jpg';
                 $order_detail['image_tag'] = preg_replace('/\\.*' . preg_quote(__PS_BASE_URI__, '/') . '/', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR, ImageManager::thumbnail($path, $name, 45, 'jpg', false), 1);
                 if (file_exists(_PS_TMP_IMG_DIR_ . $name)) {
                     $order_detail['image_size'] = getimagesize(_PS_TMP_IMG_DIR_ . $name);
                 } else {
                     $order_detail['image_size'] = false;
                 }
             }
         }
     }
     $this->smarty->assign(array('order' => $this->order, 'order_details' => $order_details, 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'order_invoice' => $this->order_invoice, 'carrier' => $carrier, 'display_product_images' => Configuration::get('PS_PDF_IMG_DELIVERY')));
     $tpls = array('style_tab' => $this->smarty->fetch($this->getTemplate('delivery-slip.style-tab')), 'addresses_tab' => $this->smarty->fetch($this->getTemplate('delivery-slip.addresses-tab')), 'summary_tab' => $this->smarty->fetch($this->getTemplate('delivery-slip.summary-tab')), 'product_tab' => $this->smarty->fetch($this->getTemplate('delivery-slip.product-tab')), 'payment_tab' => $this->smarty->fetch($this->getTemplate('delivery-slip.payment-tab')));
     $this->smarty->assign($tpls);
     return $this->smarty->fetch($this->getTemplate('delivery-slip'));
 }
開發者ID:jpodracky,項目名稱:dogs,代碼行數:36,代碼來源:HTMLTemplateDeliverySlip.php

示例7: renderForm

 public function renderForm()
 {
     /** @var Shop $obj */
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $image = _PS_CITY_IMG_DIR_ . $obj->id . '.jpg';
     $image_url = ImageManager::thumbnail($image, $this->table . '_' . (int) $obj->id . '.' . $this->imageType, 350, $this->imageType, true, true);
     $image_size = file_exists($image) ? filesize($image) / 1000 : false;
     $this->fields_form = array('legend' => array('title' => $this->l('Città'), 'icon' => 'icon-globe'), 'input' => array(array('type' => 'text', 'label' => $this->l('Nome'), 'name' => 'name', 'maxlength' => 255, 'lang' => true, 'required' => true, 'hint' => $this->l('Indica il nome della città.')), array('type' => 'text', 'label' => $this->l('Codice ISTAT'), 'name' => 'iso_code', 'maxlength' => 255, 'required' => true, 'class' => 'uppercase', 'hint' => $this->l('Inserisci il codice alfanumerico ISTAT.')), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => true, 'default_value' => (int) Context::getContext()->country->id, 'options' => array('query' => Country::getCountries(Context::getContext()->language->id, false, true), 'id' => 'id_country', 'name' => 'name'), 'hint' => $this->l('Nazione della città.')), array('type' => 'text', 'label' => $this->l('Link rewrite'), 'name' => 'link_rewrite', 'maxlength' => 255, 'lang' => true, 'required' => true, 'havingFilter' => 'url', 'hint' => $this->l('URL della città.')), array('type' => 'file', 'label' => $this->l('Immagine'), 'name' => 'image', 'display_image' => true, 'image' => $image_url ? $image_url : false, 'size' => $image_size, 'hint' => $this->l('Storefront picture.')), array('type' => 'text', 'label' => $this->l('Legend'), 'name' => 'legend', 'maxlength' => 255, 'lang' => true, 'required' => true, 'hint' => $this->l("Didascalia dell'immagine"))), 'submit' => array('title' => $this->l('Save')));
     return parent::renderForm();
 }
開發者ID:paolobattistella,項目名稱:aphro,代碼行數:12,代碼來源:AdminAphCitiesController.php

示例8: ajaxProcessuploadThumbnailImages

 public function ajaxProcessuploadThumbnailImages()
 {
     $category = new Category((int) Tools::getValue('id_category'));
     if (isset($_FILES['thumbnail'])) {
         //Get total of image already present in directory
         $files = scandir(_PS_CAT_IMG_DIR_);
         $assigned_keys = array();
         $allowed_keys = array(0, 1, 2);
         foreach ($files as $file) {
             $matches = array();
             if (preg_match('/' . $category->id . '-([0-9])?_thumb.jpg/i', $file, $matches) === 1) {
                 $assigned_keys[] = (int) $matches[1];
             }
         }
         $available_keys = array_diff($allowed_keys, $assigned_keys);
         $helper = new HelperImageUploader('thumbnail');
         $files = $helper->process();
         $total_errors = array();
         if (count($available_keys) < count($files)) {
             $total_errors[] = sprintf(Tools::displayError('You cannot upload more than %s files'), count($available_keys));
             die;
         }
         foreach ($files as $key => &$file) {
             $id = array_shift($available_keys);
             $errors = array();
             // Evaluate the memory required to resize the image: if it's too much, you can't resize it.
             if (!ImageManager::checkImageMemoryLimit($file['save_path'])) {
                 $errors[] = Tools::displayError('Due to memory limit restrictions, this image cannot be loaded. Please increase your memory_limit value via your server\'s configuration settings. ');
             }
             // Copy new image
             if (empty($errors) && !ImageManager::resize($file['save_path'], _PS_CAT_IMG_DIR_ . (int) Tools::getValue('id_category') . '-' . $id . '_thumb.jpg')) {
                 $errors[] = Tools::displayError('An error occurred while uploading the image.');
             }
             if (count($errors)) {
                 $total_errors = array_merge($total_errors, $errors);
             }
             unlink($file['save_path']);
             //Necesary to prevent hacking
             unset($file['save_path']);
             //Add image preview and delete url
             $file['image'] = ImageManager::thumbnail(_PS_CAT_IMG_DIR_ . (int) $category->id . '-' . $id . '_thumb.jpg', $this->context->controller->table . '_' . (int) $category->id . '-' . $id . '_thumb.jpg', 100, 'jpg', true, true);
             $file['delete_url'] = Context::getContext()->link->getAdminLink('AdminBlockCategories') . '&deleteThumb=' . $id . '&id_category=' . (int) $category->id . '&updatecategory';
         }
         if (count($total_errors)) {
             $this->context->controller->errors = array_merge($this->context->controller->errors, $total_errors);
         } else {
             Tools::clearSmartyCache();
         }
         die(Tools::jsonEncode(array('thumbnail' => $files)));
     }
 }
開發者ID:dev-lav,項目名稱:htdocs,代碼行數:51,代碼來源:AdminBlockCategoriesController.php

示例9: getThumbnailForListing

 /**
  * Old legacy way to generate a thumbnail.
  *
  * Use it upon a new Image management system is available.
  *
  * @param $imageId
  * @param string $imageType
  * @param string $tableName
  * @param string $imageDir
  * @return string The HTML < img > tag
  */
 public function getThumbnailForListing($imageId, $imageType = 'jpg', $tableName = 'product', $imageDir = 'p')
 {
     if ($tableName == 'product') {
         $image = new \Image($imageId);
         $path_to_image = _PS_IMG_DIR_ . $imageDir . '/' . $image->getExistingImgPath() . '.' . $imageType;
     } else {
         $path_to_image = _PS_IMG_DIR_ . $imageDir . '/' . $imageId . '.' . $imageType;
     }
     $thumbPath = \ImageManager::thumbnail($path_to_image, $tableName . '_mini_' . $imageId . '.' . $imageType, 45, $imageType);
     // because legacy uses relative path to reach a directory under root directory...
     $replacement = 'src="' . $this->legacyContext->getRootUrl();
     $thumbPath = preg_replace('/src="(\\.\\.\\/)+/', $replacement, $thumbPath);
     return $thumbPath;
 }
開發者ID:M03G,項目名稱:PrestaShop,代碼行數:25,代碼來源:ImageManager.php

示例10: renderForm

 public function renderForm()
 {
     $this->toolbar_btn['save-and-stay'] = array('href' => '#', 'desc' => $this->l('Save and stay'));
     $defaultLanguage = $this->default_form_language;
     $this->initToolbar();
     if (!$this->loadObject(true)) {
         return;
     }
     $this->fields_form = array('tinymce' => true, 'legend' => array('title' => $this->l('Photo'), 'image' => '../img/admin/tab-categories.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Title:'), 'name' => 'name', 'required' => true, 'lang' => true, 'class' => 'copy2friendlyUrl', 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Meta Title:'), 'name' => 'meta_title', 'lang' => true, 'class' => '', 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Meta Keword:'), 'name' => 'meta_keywords', 'lang' => true, 'class' => '', 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'textarea', 'label' => $this->l('Meta Description :'), 'name' => 'meta_description', 'autoload_rte' => true, 'rows' => 10, 'cols' => 100, 'lang' => true, 'desc' => $this->l('Will be displayed in top of category page')), array('type' => 'textarea', 'label' => $this->l('Description :'), 'name' => 'description', 'autoload_rte' => true, 'rows' => 10, 'cols' => 100, 'lang' => true, 'desc' => $this->l('Will be displayed in top of category page')), array('type' => 'file', 'label' => $this->l('Image :'), 'name' => 'image', 'required' => true), array('type' => 'text', 'label' => $this->l('Youtube:'), 'name' => 'youtube_id', 'class' => '', 'required' => FALSE), array('type' => 'text', 'label' => $this->l('Friendly URL:'), 'name' => 'link_rewrite', 'lang' => true, 'required' => true, 'hint' => $this->l('Only letters and the minus (-) character are allowed.'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
     $this->fields_form['input'][] = array('type' => 'text', 'label' => $this->l('Position :'), 'size' => 3, 'name' => 'position');
     $this->fields_form['input'][] = array('type' => 'radio', 'label' => $this->l('Status :'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))));
     if (!($news = $this->loadObject(true))) {
         return;
     }
     $image = ImageManager::thumbnail(_PS_PSNEWS_IMG_DIR_ . '/' . $news->id_news . '.jpg', $this->table . '_' . (int) $news->id_news . '.' . $this->imageType, 350, $this->imageType, true);
     $this->fields_value = array('image' => $image ? $image : false, 'size' => $image ? filesize(_PS_PSNEWS_IMG_DIR_ . '/' . $news->id_news . '.jpg') / 1000 : false);
     $this->tpl_form_vars = array('active' => $this->object->active, 'PS_ALLOW_ACCENTED_CHARS_URL', (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'));
     return parent::renderForm();
 }
開發者ID:rongandat,項目名稱:vatfairfoot,代碼行數:19,代碼來源:AdminNews.php

示例11: createCover

 public function createCover($img = null, $object = null)
 {
     if (!isset($img)) {
         die('AdminSimpleBlogCategoryController@createCover: No image to process');
     }
     $categoryImgX = Configuration::get('PH_CATEGORY_IMAGE_X');
     $categoryImgY = Configuration::get('PH_CATEGORY_IMAGE_Y');
     if (isset($object) && Validate::isLoadedObject($object)) {
         $fileTmpLoc = $img;
         $origPath = _PS_MODULE_DIR_ . 'ph_simpleblog/covers_cat/' . $object->id . '.' . $object->cover;
         $tmp_location = _PS_TMP_IMG_DIR_ . 'ph_simpleblog_cat_' . $object->id . '.' . $object->cover;
         if (file_exists($tmp_location)) {
             @unlink($tmp_location);
         }
         try {
             $orig = PhpThumbFactory::create($fileTmpLoc);
         } catch (Exception $e) {
             echo $e;
         }
         $orig->adaptiveResize($categoryImgX, $categoryImgY);
         return $orig->save($origPath) && ImageManager::thumbnail(_PS_MODULE_DIR_ . 'ph_simpleblog/covers_cat/' . $object->id . '.' . $object->cover, 'ph_simpleblog_cat_' . $object->id . '.' . $object->cover, 350, $object->cover);
     }
 }
開發者ID:evgrishin,項目名稱:se1614,代碼行數:23,代碼來源:AdminSimpleBlogCategoriesController.php

示例12: getTableMostViewed

 public function getTableMostViewed($date_from, $date_to)
 {
     $header = array(array('id' => 'image', 'title' => $this->l('Image'), 'class' => 'text-center'), array('id' => 'product', 'title' => $this->l('Product'), 'class' => 'text-center'), array('id' => 'views', 'title' => $this->l('Views'), 'class' => 'text-center'), array('id' => 'added_to_cart', 'title' => $this->l('Added to cart'), 'class' => 'text-center'), array('id' => 'purchased', 'title' => $this->l('Purchased'), 'class' => 'text-center'), array('id' => 'rate', 'title' => $this->l('Percentage'), 'class' => 'text-center'));
     if (Configuration::get('PS_STATSDATA_PAGESVIEWS')) {
         $products = $this->getTotalViewed($date_from, $date_to, (int) Configuration::get('DASHPRODUCT_NBR_SHOW_MOST_VIEWED'));
         $body = array();
         if (is_array($products) && count($products)) {
             foreach ($products as $product) {
                 $product_obj = new Product((int) $product['id_object'], true, $this->context->language->id);
                 if (!Validate::isLoadedObject($product_obj)) {
                     continue;
                 }
                 $img = '';
                 if (($row_image = Product::getCover($product_obj->id)) && $row_image['id_image']) {
                     $image = new Image($row_image['id_image']);
                     $path_to_image = _PS_PROD_IMG_DIR_ . $image->getExistingImgPath() . '.' . $this->context->controller->imageType;
                     $img = ImageManager::thumbnail($path_to_image, 'product_mini_' . $product_obj->id . '.' . $this->context->controller->imageType, 45, $this->context->controller->imageType);
                 }
                 $tr = array();
                 $tr[] = array('id' => 'product', 'value' => $img, 'class' => 'text-center');
                 $tr[] = array('id' => 'product', 'value' => Tools::htmlentitiesUTF8($product_obj->name) . '<br/>' . Tools::displayPrice(Product::getPriceStatic((int) $product_obj->id)), 'class' => 'text-center');
                 $tr[] = array('id' => 'views', 'value' => $product['counter'], 'class' => 'text-center');
                 $added_cart = $this->getTotalProductAddedCart($date_from, $date_to, (int) $product_obj->id);
                 $tr[] = array('id' => 'added_to_cart', 'value' => $added_cart, 'class' => 'text-center');
                 $purchased = $this->getTotalProductPurchased($date_from, $date_to, (int) $product_obj->id);
                 $tr[] = array('id' => 'purchased', 'value' => $this->getTotalProductPurchased($date_from, $date_to, (int) $product_obj->id), 'class' => 'text-center');
                 $tr[] = array('id' => 'rate', 'value' => $product['counter'] ? round(100 * $purchased / $product['counter'], 1) . '%' : '-', 'class' => 'text-center');
                 $body[] = $tr;
             }
         }
     } else {
         $body = '<div class="alert alert-info">' . $this->l('You must enable the "Save global page views" option from the "Data mining for statistics" module in order to display the most viewed products, or use the Google Analytics module.') . '</div>';
     }
     return array('header' => $header, 'body' => $body);
 }
開發者ID:AmineBENCHEIKHBRAHIM,項目名稱:LnsTech-Prestashop-WebSite,代碼行數:35,代碼來源:dashproducts.php

示例13: renderForm

 public function renderForm()
 {
     $this->post_format_fields = smartblog::$post_meta_fields;
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $shops = false;
     if (Shop::isFeatureActive()) {
         $shops = Shop::getShops();
     }
     if ($shops) {
         foreach ($shops as $key => $shop) {
             if (!$obj->isAssociatedToShop($shop['id_shop'])) {
                 unset($shops[$key]);
             }
         }
     }
     $languages = Language::getLanguages(false);
     //Added From Old
     /*         * ************* featured image ****************** */
     $featured_image = _MODULE_SMARTBLOG_DIR_ . $obj->id . '.jpg';
     $image_url = ImageManager::thumbnail($featured_image, $this->table . '_' . pSQL(Tools::getvalue('id_smart_blog_post')) . '.jpg', 200, 'jpg', true, true);
     $image_size = file_exists($featured_image) ? filesize($featured_image) / 1000 : false;
     /*         * ************* featured image ****************** */
     // image gallary
     $id_smart_blog_post = (int) Tools::getValue('id_smart_blog_post');
     $images = SmartBlogGallaryImage::getImages($this->context->language->id, $id_smart_blog_post);
     foreach ($images as $k => $image) {
         $images[$k] = new SmartBlogGallaryImage($image['id_smart_blog_gallary_images']);
     }
     //start sdsimage type
     $image_uploader = new HelperImageUploader('file');
     $image_uploader->setMultiple(!(Tools::getUserBrowser() == 'Apple Safari' && Tools::getUserPlatform() == 'Windows'))->setUseAjax(true)->setUrl(Context::getContext()->link->getAdminLink('AdminSmartBlogAjax') . '&ajax=1&id_smart_blog_post=' . (int) Tools::getvalue('id_smart_blog_post') . '&action=addGallaryImage');
     // test code
     $root = BlogCategory::getRootCategory();
     $default_category = $root['id_smart_blog_category'];
     if (!Tools::isSubmit('id_smart_blog_post')) {
         $selected_cat = BlogCategory::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->default_form_language);
     } else {
         if (Tools::isSubmit('categoryBox')) {
             $selected_cat = BlogCategory::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->default_form_language);
         } else {
             $selected_cat = BlogCategory::getPostCategoriesFull((int) Tools::getValue('id_smart_blog_post'), $this->default_form_language);
         }
     }
     $categories = array();
     foreach ($selected_cat as $key => $category) {
         $categories[] = $key;
     }
     $tree = new SmartBlogHelperTreeCategories('smartblog-associated-categories-tree', 'Associated categories');
     $tree->setTemplate('tree_associated_categories.tpl')->setHeaderTemplate('tree_associated_header.tpl')->setRootCategory((int) $root['id_category'])->setUseCheckBox(true)->setUseSearch(false)->setSelectedCategories($categories);
     // end test code
     $temp_employees = Employee::getEmployees();
     $employees = array();
     foreach ($temp_employees as $employee) {
         $employee['fullname'] = $employee['firstname'] . ' ' . $employee['lastname'];
         $employee['id_select'] = $employee['id_employee'];
         $employees[] = $employee;
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Blog Post')), 'input' => array(array('type' => 'text', 'label' => $this->l('Blog Title'), 'name' => 'meta_title', 'id' => 'name', 'class' => 'copyMeta2friendlyURL', 'size' => 60, 'required' => true, 'desc' => $this->l('Enter Your Blog Post Title'), 'lang' => true), array('type' => 'select', 'label' => $this->l('Author'), 'name' => 'id_author', 'options' => array('query' => $employees, 'id' => 'id_select', 'name' => 'fullname')), array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'content', 'lang' => true, 'rows' => 10, 'cols' => 62, 'class' => 'rte', 'autoload_rte' => true, 'desc' => $this->l('Enter Your Post Description')), array('type' => 'file', 'label' => $this->l('Featured Image:'), 'name' => 'image', 'display_image' => true, 'image' => $image_url ? $image_url : false, 'size' => $image_size, 'delete_url' => self::$currentIndex . '&' . $this->identifier . '=' . pSQL(Tools::getvalue('id_smart_blog_post')) . '&token=' . $this->token . '&deleteImage=1', 'hint' => $this->l('Upload a feature image from your computer.')), array('type' => 'html', 'label' => $this->l('Blog Categories'), 'name' => 'id_category_big', 'required' => true, 'html_content' => $tree->render(), 'desc' => $this->l('Select Your Parent Category')), array('type' => 'text', 'label' => $this->l('Meta Keyword'), 'name' => 'meta_keyword', 'lang' => true, 'size' => 60, 'required' => false, 'desc' => $this->l('Enter Your Post Meta Keyword. Separated by comma(,)')), array('type' => 'textarea', 'label' => $this->l('Short Description'), 'name' => 'short_description', 'rows' => 10, 'cols' => 62, 'lang' => true, 'required' => true, 'desc' => $this->l('Enter Your Post Short Description')), array('type' => 'textarea', 'label' => $this->l('Meta Description'), 'name' => 'meta_description', 'rows' => 10, 'cols' => 62, 'lang' => true, 'required' => false, 'desc' => $this->l('Enter Your Post Meta Description')), array('type' => 'text', 'label' => $this->l('Link Rewrite'), 'name' => 'link_rewrite', 'size' => 60, 'lang' => true, 'required' => false, 'desc' => $this->l('Enetr Your Post Slug. Use In SEO Friendly URL')), array('type' => 'tags', 'label' => $this->l('Tag'), 'name' => 'tags', 'size' => 60, 'lang' => true, 'required' => false, 'hint' => array($this->l('To add "tags" click in the field, write something, and then press "Enter."'), $this->l('Invalid characters:') . ' &lt;&gt;;=#{}')), array('type' => 'switch', 'label' => $this->l('Comment Status'), 'name' => 'comment_status', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('You Can Enable or Disable Your Comments')), array('label' => $this->l('Published Date'), 'name' => 'created', 'title' => $this->l('Published date'), 'type' => 'datetime'), array('type' => 'associations', 'label' => $this->l('Related Product(s)'), 'name' => 'associations', 'size' => 60, 'lang' => true, 'required' => false), array('type' => 'switch', 'label' => $this->l('Status'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'switch', 'label' => $this->l('Is Featured?'), 'name' => 'is_featured', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))), 'gallary' => array('images' => array('count' => count($images), 'max_image_size' => $this->max_image_size / 1024 / 1024, 'table' => $this->table, 'images' => $images, 'id_smart_blog_post' => (int) Tools::getValue('id_smart_blog_post'), 'object' => $this->object, 'image_uploader' => $image_uploader->render())));
     $this->fields_form['input'][] = array('type' => 'radio', 'label' => $this->l('Post Format'), 'name' => 'post_type', 'required' => true, 'values' => array(array('id' => 'post_type_default', 'value' => '', 'label' => '<i class="icon-home"></i> ' . $this->l('None')), array('id' => 'post_type_gallery', 'value' => 'gallery', 'label' => '<i class="icon-picture"></i> ' . $this->l('Gallery')), array('id' => 'post_type_audio', 'value' => 'audio', 'label' => '<i class="icon-music"></i> ' . $this->l('Audio')), array('id' => 'post_type_video', 'value' => 'video', 'label' => '<i class="icon-film"></i> ' . $this->l('Video')), array('id' => 'post_type_quote', 'value' => 'quote', 'label' => '<i class="icon-quote-left"></i> ' . $this->l('Quote')), array('id' => 'post_type_link', 'value' => 'link', 'label' => '<i class="icon-link"></i> ' . $this->l('Link'))));
     $this->fields_form['input'][] = array('type' => 'html', 'label' => $this->l('Post Format Fields'), 'name' => 'post_format_fields', 'html_content' => $this->AdminMetaFields(), 'desc' => $this->l('Set exclusive fields for the post format'));
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
     }
     if (!($SmartBlogPost = $this->loadObject(true))) {
         return;
     }
     $this->fields_form['submit'] = array('title' => $this->l('Save'));
     $image = ImageManager::thumbnail(_MODULE_SMARTBLOG_DIR_ . $SmartBlogPost->id_smart_blog_post . '.jpg', $this->table . '_' . (int) $SmartBlogPost->id_smart_blog_post . '.' . $this->imageType, 350, $this->imageType, true);
     $this->fields_value = array('image' => $image ? $image : false, 'size' => $image ? filesize(_MODULE_SMARTBLOG_DIR_ . $SmartBlogPost->id_smart_blog_post . '.jpg') / 1000 : false);
     if (Tools::getvalue('id_smart_blog_post') != '' && Tools::getvalue('id_smart_blog_post') != NULL) {
         foreach (Language::getLanguages(false) as $lang) {
             $this->fields_value['tags'][(int) $lang['id_lang']] = SmartBlogPost::getProductTagsBylang((int) Tools::getvalue('id_smart_blog_post'), (int) $lang['id_lang']);
         }
     }
     $this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL');
     // related product using Accessories block
     $accessories = SmartBlogPost::getAccessoriesLight($this->context->language->id, $SmartBlogPost->id_smart_blog_post);
     if ($post_accessories = Tools::getValue('inputAccessories')) {
         $post_accessories_tab = explode('-', $post_accessories);
         foreach ($post_accessories_tab as $accessory_id) {
             if (!$this->haveThisAccessory($accessory_id, $accessories) && ($accessory = Product::getAccessoryById($accessory_id))) {
                 $accessories[] = $accessory;
             }
         }
     }
     $this->tpl_form_vars['accessories'] = $accessories;
     /* image gallary */
     $this->tpl_form_vars['images'] = $images;
     $this->tpl_form_vars['image_uploader'] = $image_uploader->render();
     $this->tpl_form_vars['max_image_size'] = $this->max_image_size / 1024 / 1024;
     $this->tpl_form_vars['languages'] = $languages;
     $this->tpl_form_vars['iso_lang'] = $languages[0]['iso_code'];
     $this->tpl_form_vars['imageType'] = 'home-small';
     $this->tpl_form_vars['id_smart_blog_post'] = (int) Tools::getValue('id_smart_blog_post');
     $this->tpl_form_vars['default_language'] = (int) Configuration::get('PS_LANG_DEFAULT');
     $this->tpl_form_vars['table'] = $this->table;
     $this->tpl_form_vars['token'] = Tools::getAdminTokenLite('AdminBlogPost');
     $this->tpl_form_vars['gallary_path'] = _MODULE_DIR_ . 'smartblog/gallary/';
//.........這裏部分代碼省略.........
開發者ID:johnulist,項目名稱:smartblog,代碼行數:101,代碼來源:AdminBlogPostController.php

示例14: renderForm

 public function renderForm()
 {
     $img_desc = '';
     $img_desc .= $this->l('Upload a Feature Image from your computer.<br/>N.B : Only jpg image is allowed');
     if (Tools::getvalue('id_smart_blog_post') != '' && Tools::getvalue('id_smart_blog_post') != NULL) {
         $img_desc .= '<br/><img style="height:auto;width:300px;clear:both;border:1px solid black;" alt="" src="' . __PS_BASE_URI__ . 'modules/smartblog/images/' . Tools::getvalue('id_smart_blog_post') . '.jpg" /><br />';
     }
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $image = _MODULE_SMARTBLOG_DIR_ . $obj->id . '.jpg';
     $image_url = ImageManager::thumbnail($image, $this->table . '_' . Tools::getvalue('id_smart_blog_post') . '.jpg', 200, 'jpg', true, true);
     $image_size = file_exists($image) ? filesize($image) / 1000 : false;
     $this->fields_form = array('legend' => array('title' => $this->l('Blog Post')), 'input' => array(array('type' => 'hidden', 'name' => 'post_type', 'default_value' => 0), array('type' => 'text', 'label' => $this->l('Blog Title'), 'name' => 'meta_title', 'id' => 'name', 'class' => 'copyMeta2friendlyURL', 'size' => 60, 'required' => true, 'desc' => $this->l('Enter Your Blog Post Title'), 'lang' => true), array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'content', 'lang' => true, 'rows' => 10, 'cols' => 62, 'class' => 'rte', 'autoload_rte' => true, 'required' => true, 'hint' => array($this->l('Enter Your Post Description'), $this->l('Invalid characters:') . ' <>;=#{}')), array('type' => 'file', 'label' => $this->l('Feature Image:'), 'name' => 'image', 'display_image' => true, 'image' => $image_url ? $image_url : false, 'size' => $image_size, 'delete_url' => self::$currentIndex . '&' . $this->identifier . '=' . Tools::getvalue('id_smart_blog_post') . '&token=' . $this->token . '&deleteImage=1', 'hint' => $this->l('Upload a feature image from your computer.')), array('type' => 'select', 'label' => $this->l('Blog Category'), 'name' => 'id_category', 'options' => array('query' => BlogCategory::getCategory(), 'id' => 'id_smart_blog_category', 'name' => 'meta_title'), 'desc' => $this->l('Select Your Parent Category')), array('type' => 'tags', 'label' => $this->l('Meta keywords'), 'name' => 'meta_keywords', 'lang' => true, 'hint' => array($this->l('To add "tags" click in the field, write something, and then press "Enter."'), $this->l('Invalid characters:') . ' &lt;&gt;;=#{}')), array('type' => 'textarea', 'label' => $this->l('Short Description'), 'name' => 'short_description', 'rows' => 10, 'cols' => 62, 'lang' => true, 'required' => true, 'hint' => array($this->l('Enter Your Post Short Description'))), array('type' => 'textarea', 'label' => $this->l('Meta Description'), 'name' => 'meta_description', 'rows' => 10, 'cols' => 62, 'lang' => true, 'required' => false, 'desc' => $this->l('Enter Your Post Meta Description')), array('type' => 'text', 'label' => $this->l('Link Rewrite'), 'name' => 'link_rewrite', 'size' => 60, 'lang' => true, 'required' => false, 'hint' => $this->l('Only letters and the hyphen (-) character are allowed.')), array('type' => 'tags', 'label' => $this->l('Tag'), 'name' => 'tags', 'size' => 60, 'lang' => true, 'required' => false, 'hint' => array($this->l('To add "tags" click in the field, write something, and then press "Enter."'), $this->l('Invalid characters:') . ' &lt;&gt;;=#{}')), array('type' => 'radio', 'label' => $this->l('Comment Status'), 'name' => 'comment_status', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('You Can Enable or Disable Your Comments')), array('type' => 'radio', 'label' => $this->l('Status'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Is Featured?'), 'name' => 'is_featured', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'is_featured', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'is_featured', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
     }
     if (!($SmartBlogPost = $this->loadObject(true))) {
         return;
     }
     $this->fields_form['submit'] = array('title' => $this->l('Save   '), 'class' => 'button');
     $image = ImageManager::thumbnail(_MODULE_SMARTBLOG_DIR_ . $SmartBlogPost->id_smart_blog_post . '.jpg', $this->table . '_' . (int) $SmartBlogPost->id_smart_blog_post . '.' . $this->imageType, 350, $this->imageType, true);
     $this->fields_value = array('image' => $image ? $image : false, 'size' => $image ? filesize(_MODULE_SMARTBLOG_DIR_ . $SmartBlogPost->id_smart_blog_post . '.jpg') / 1000 : false);
     if (Tools::getvalue('id_smart_blog_post') != '' && Tools::getvalue('id_smart_blog_post') != NULL) {
         foreach (Language::getLanguages(false) as $lang) {
             $this->fields_value['tags'][(int) $lang['id_lang']] = SmartBlogPost::getProductTagsBylang((int) Tools::getvalue('id_smart_blog_post'), (int) $lang['id_lang']);
         }
     }
     $this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL');
     return parent::renderForm();
 }
開發者ID:webaider,項目名稱:smartblog,代碼行數:31,代碼來源:AdminBlogPostController.php

示例15: renderForm

 public function renderForm()
 {
     $this->fields_form = array('tinymce' => true, 'legend' => array('title' => $this->l('Images'), 'image' => '../img/admin/cog.gif'), 'input' => array(array('type' => 'select', 'label' => $this->l('Slideshow:'), 'name' => 'id_opartslideshow_slideshow', 'cast' => 'intval', 'options' => array('query' => $this->getSlideshows(), 'name' => 'name', 'id' => 'key')), array('type' => 'file', 'label' => 'image', 'name' => 'image_file', 'display_image' => true), array('type' => 'text', 'lang' => true, 'label' => $this->l('Name:'), 'name' => 'name', 'size' => 40), array('type' => 'text', 'lang' => true, 'label' => $this->l('Url:'), 'name' => 'targeturl', 'size' => 255), array('type' => 'text', 'lang' => true, 'label' => $this->l('Description:'), 'name' => 'description', 'size' => 255), array('type' => 'text', 'label' => $this->l('Filename:'), 'name' => 'filename', 'size' => 50, 'readonly' => true), array('type' => 'select', 'label' => $this->l('Statut:'), 'name' => 'active', 'cast' => 'intval', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('disable')), array('key' => 1, 'name' => $this->l('enable'))), 'name' => 'name', 'id' => 'key'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $filename = $obj->filename;
     $image = ImageManager::thumbnail($this->imgDir . $filename, $this->table . '_' . $filename, 350, $this->imageType, false);
     if (file_exists($this->imgDir . $filename)) {
         $this->fields_value['image'] = $image ? $image : false;
         $this->fields_value['size'] = $image ? filesize($this->imgDir . $filename) / 1000 : false;
     }
     return parent::renderForm();
 }
開發者ID:AmineBENCHEIKHBRAHIM,項目名稱:LnsTech-Prestashop-WebSite,代碼行數:14,代碼來源:AdminSlideshowImageController.php


注:本文中的ImageManager::thumbnail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。