Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function aggiungiImmagine($id_product = 0, $url = "", $isCover = false){
- // check the extension of image
- $currentExtension = end(explode('.', $url));
- $urlTemp = $url;
- echo $currentExtension ."; ";
- if ($currentExtension == "png"){
- $this->png2jpg($urlTemp, _PS_MODULE_DIR_.'cmtCatalogImporter/tempDir/img/'.nomeImgTemp, qualitaImg);
- $urlTemp = tempDirImgUrl .nomeImgTemp;
- }
- $shops = Shop::getShops(true, null, true);
- $image = new Image();
- $image->id_product = $id_product;
- $image->position = Image::getHighestPosition($id_product) + 1;
- $image->cover = $isCover; // true or false;
- if (($image->validateFields(false, true)) === true &&
- ($image->validateFieldsLang(false, true)) === true && $image->add())
- {
- $image->associateTo($shops);
- if (!AdminImportControllerCustom::caricaImmagine($id_product, $image->id, $urlTemp))
- {
- //echo $url;
- //$image->delete();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement