thilipdilip 0 Newbie Poster

Hi, I 'm new to prestashop module deelopement, I created one module which customer can add their product and sell their product, in that I have mentioned image upload functionality, which is possible to add one image, now the problem with image uploader, It can able to upload single image only, now need to upload morethan one image. Here is my prestashop code.

$image->id_product = intval($product->id);
            $tmpName = tempnam(_PS_IMG_DIR_, 'PS');
            $image->position = Image::getHighestPosition($product->id) + 1;

            for ($i=0; $i< count($_FILES['design']['name']) ; $i++) {

                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']] = $name;
                $id_image = $image->id;
                move_uploaded_file($_FILES['design']['tmp_name'][$i], $tmpName);
                $new_path = $image->getPathForCreation();
                ImageManager::resize($tmpName, $new_path.'.'.$image->image_format);
                $imagesTypes = ImageType::getImagesTypes('products');
                foreach ($imagesTypes as $imageType)
                ImageManager::resize($tmpName, $new_path.'-'.stripslashes($imageType['name']).'.'.$image->image_format, $imageType['width'], $imageType['height'], $image->image_format);
                $image->add();
            }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.