Jump to content

Edit History

ChOmar

ChOmar


update

i add input like that 

 

  array(
                'type' => 'file',
                'label' => $this->l('Logo or photo'),
                'name' => 'sellerImage',
                'image' => $image_url?$image_url:'No Image',
                'size' => $image_size?$image_size:' : No size for Image',
                'display_image' => true,
                'col' => 6,
             ),

 

and this for add Image to folder
 

public function renderForm()
    {
        /** @var Customer $obj */
                $image_url = false;
        $image_size = 0;
        $customer = new Customer((int)Tools::getValue('id_customer'));
            $image = PS_IMG_DIR . 'sellers/' .$customer->id_customer . '.jpg';
            
            $image_url = ImageManager::thumbnail($image, (int)$customer->id_customer.'.jpg',200, 'jpg', true, true);
            $image_size = file_exists($image) ? filesize($image) / 1000 : false;
 

 

 public function postProcess()
    {
        if (!$this->can_add_customer && $this->display == 'add') {
            $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers');
        }
 if ($_FILES['sellerImage']['name'] != "") {
                if (!Seller::saveSellerImage($_FILES['sellerImage'], $id_customer)) {
                    $this->errors[] = $this->module->l('The image seller format is incorrect.', 'AdminSellersController');
                }
            }
        parent::postProcess();
    }

 

and that's not working for me please help

 

AdminCustomersController.php

ChOmar

ChOmar

i add input like that 

 

  array(
                'type' => 'file',
                'label' => $this->l('Logo or photo'),
                'name' => 'sellerImage',
                'image' => $image_url?$image_url:'No Image',
                'size' => $image_size?$image_size:' : No size for Image',
                'display_image' => true,
                'col' => 6,
             ),

 

and this for add Image to folder
 

$image_url = false;
$image_size = 0;

if ($_FILES['sellerImage']['name'] != "") {
   if (!Seller::saveSellerImage($_FILES['sellerImage'], $id_customer)) {
      $this->errors[] = $this->module->l('The image seller format is incorrect.', 'AdminSellersController');
   }
}

$customer = new Customer((int)Tools::getValue('id_customer'));
$image = PS_IMG_DIR . 'sellers/' .$customer->id_customer . '.jpg';
$image_url = ImageManager::thumbnail($image, (int)$customer->id_customer.'.jpg',200, 'jpg', true, true);

 

and that's not working for me please help

AdminCustomersController.php

×
×
  • Create New...