我想创建一个模块来为产品添加图像,这是我不知道该怎么做的部分
$product = new Product();
$image = new Image();
$langId = (int) (Configuration::get('PS_LANG_DEFAULT'));
$name = Tools::getValue('product_name');
$product->name = array($langId => $name);
$product->price = Tools::getValue('price');
$product->wholesale_price = Tools::getValue('wholesale_price');
$product->active = false;
$product->is_virtual = true;
$product->cache_has_attachments = true;
$product->id_category_default=3;
$product->reference = $this->context->cookie->id_customer;
$product->link_rewrite = array($langId => Tools::link_rewrite($name));
$product->add();
$image->id_product = intval($product->id);
$image->position = Image::getHighestPosition($product->id) + 1;
if(Image::getImagesTotal($product->id)>0)
$image->cover = false;
else
$image->cover = true;
$languages = Language::getLanguages();
foreach ($languages as $language)
$image->legend[$language['id_lang']] = 'Click to view';
$id_image = $image->id;
$image->add();
$tmpName = tempnam(_PS_IMG_DIR_, 'PS');
move_uploaded_file($_FILES['design']['tmp_name'], $tmpName);
在上面你看到我为产品添加图像的代码,但我的 BackOffice 中什么也没有,我应该怎么做才能让它出现并上传不同尺寸的图像