Open Sabirgojayev opened 7 years ago
The following is my code. In model:
public function behaviors() { return [ 'galleryBehavior' => [ 'class' => GalleryBehavior::className(), 'type' => 'product', 'extension' => 'jpg', 'directory' => Yii::getAlias('@webroot') . '/images/product/gallery', 'url' => Yii::getAlias('@web') . '/images/product/gallery', 'versions' => [ 'small' => function ($img) { /** @var \Imagine\Image\ImageInterface $img */ return $img ->copy() ->thumbnail(new \Imagine\Image\Box(200, 200)); }, 'medium' => function ($img) { /** @var Imagine\Image\ImageInterface $img */ $dstSize = $img->getSize(); $maxWidth = 800; if ($dstSize->getWidth() > $maxWidth) { $dstSize = $dstSize->widen($maxWidth); } return $img ->copy() ->resize($dstSize); }, ] ] ]; }
In controller:
'galleryApi' => [ 'class' => GalleryManagerAction::className(), // mappings between type names and model classes (should be the same as in behaviour) 'types' => [ 'product' => CreateNews::className() ] ],
When I try to add photo it gives the following error: POST http://azreal.az/admin/product/galleryApi?type=product&behaviorName=galleryBehavior&galleryId=10407&action=ajaxUpload 404 (Not Found)
I have exactly the same error There is a 404 error for each file that I tried to upload, no damn chance to work...please help
Never mind, now I have 500 error
The following is my code. In model:
In controller:
When I try to add photo it gives the following error: POST http://azreal.az/admin/product/galleryApi?type=product&behaviorName=galleryBehavior&galleryId=10407&action=ajaxUpload 404 (Not Found)