kobylecki Posted October 22, 2012 Share Posted October 22, 2012 Hi! I wrote method to adding image to product some time ago (when was older system of images). public function create_image($product_id, $image_path) { // create an image $img = new Image($product_id); $img->id_product = $product_id; $img->save(); // path to image without extension $path = self::PRODUCT_IMG_DIR.$product_id.'-'.$img->id; // copy image copy($image_path, $path.'.jpg'); // generate thumbnails $images_types = ImageType::getImagesTypes(); foreach ($images_types as $image_type) ImageManager::resize( $path.'.jpg', $path.'-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']); } Then it was enought to just copy image to destination 'img/p/' and name it according to pattern and then just use resizer to generate all thumbnails. But what to do in new system of images? Where image should resist? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now