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

404, yii2 advanced, additional application #92

Open
IljaPHP opened this issue Aug 8, 2019 · 0 comments
Open

404, yii2 advanced, additional application #92

IljaPHP opened this issue Aug 8, 2019 · 0 comments

Comments

@IljaPHP
Copy link

IljaPHP commented Aug 8, 2019

I can upload and see images by admin panel in back-end application without any problems and see images in the "frontend" yii2 application also, but I have an additional separate front-end application and I can't see images there. It's returns 404 error.

Take one image, for example, that has one URL in all applications, but all applications have different domain names.

My common/config/main.php :

'modules' => [
'yii2images' => [
'class' => 'rico\yii2images\Module',
//be sure, that permissions ok
//if you cant avoid permission errors you have to create "images" folder in web root manually and set 777 permissions
'imagesStorePath' => '@root/upload/store', //path to origin images
'imagesCachePath' => '@root/upload/cache', //path to resized copies
'graphicsLibrary' => 'GD', //but really its better to use 'Imagick'
'placeHolderPath' => '@root/upload/store/no-image.png', // if you want to get placeholder when image not exists, string will be processed by Yii::getAlias
'imageCompressionQuality' => 85, // Optional. Default value is 85.
]

Same code of Costa-Rico/images in all 3 models:

  public $gallery;
  public $gallery_url;

    public function behaviors()
    {
        return [
            'image' => [
                'class' => 'rico\yii2images\behaviors\ImageBehave',
            ]
        ];
    }

In the separate frontend application I trying to show image by with code:

   $general_logo =  General::find()->where(['index' => 'logo_social'])->one();
   if($general_logo) $image = $general_logo->getImage();
   if($general_logo && $image) : ?>
      <meta property="og:image" content="<?= $image->getUrl(); ?>"/>
   <?php endif; ?>

I was trying to use frontend\models\General and creating of own this_separate_application\models\General (ActiveRecord, same table) for this application.

How I can to solve this problem? Thank you.

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

1 participant