Ejemplo n.º 1
0
 private static function createAndUploadImage($product, array $imageArray, $shopId, $imgPath)
 {
     $image = new Image();
     $image->id_product = $product->id;
     $image->position = Image::getHighestPosition($product->id) + 1;
     $image->legend = $imageArray['alt'];
     $image->save();
     ImageUploader::upload($product->id, $image->id, $imgPath . $imageArray['src'], 'products', true, $shopId);
 }
Ejemplo n.º 2
0
 private static function createAndUploadImage($category, array $imageArray, $shopId, $imgPath)
 {
     $image = new Image();
     $image->legend = $imageArray['alt'];
     $image->save();
     ImageUploader::upload($category->id, $image->id, $imgPath . $imageArray['src'], 'categories', true, $shopId);
     $category->id_image = $image->id;
     $category->update();
 }