Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It gives 404 when I upload a photo #45

Open
Sabirgojayev opened this issue Apr 11, 2017 · 2 comments
Open

It gives 404 when I upload a photo #45

Sabirgojayev opened this issue Apr 11, 2017 · 2 comments

Comments

@Sabirgojayev
Copy link

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)

@bogdan-baerov
Copy link

bogdan-baerov commented Sep 7, 2017

I have exactly the same error
untitled
There is a 404 error for each file that I tried to upload, no damn chance to work...please help

@bogdan-baerov
Copy link

Never mind, now I have 500 error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants