Yii Framework Forum: yii2images issue - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

yii2images issue yii2images issue Rate Topic: -----

#1 User is offline   peter_ykt 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 07-January 18

Posted 12 March 2018 - 05:59 AM

I installed from composer php 7.1
Everything looks ok, images names and paths stored in database, but when i am trying to show in DetailView
<?php $img = $model->getImage(); ?>
<?= DetailView::widget([
'model' => model,
'attributes' => [
'id',
'category_id',
'name',
['attribute' => 'image',
'value' => "<img src='{$img->getUrl()}'>",
]
]) ?>
It giving me wrong path:
<img src='/6/images/image-by-item-and-alias?item=Product6&dirtyAlias=b8895666dc-1.png'>
But it should be:
yii2images instead of 6 - at start of url
Why?
0

#2 User is offline   _marcelo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 22-October 15
  • Location:MaceiĆ³ / Brazil

Posted 12 March 2018 - 07:26 AM

How the image path is saved?
0

#3 User is offline   peter_ykt 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 07-January 18

Posted 12 March 2018 - 04:05 PM

View Post_marcelo, on 12 March 2018 - 07:26 AM, said:

How the image path is saved?

if i write:
'value' => "<img src='/yii2images/images/image-by-item-and-alias item=Product6&dirtyAlias=b8895666dc-1.png'>",
image is ok
Attached File  image_path.png (8.38K)
Number of downloads: 3
0

#4 User is offline   George Shestayev 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 09-January 18

Posted 13 March 2018 - 08:26 AM

View Postpeter_ykt, on 12 March 2018 - 04:05 PM, said:

if i write:
'value' => "<img src='/yii2images/images/image-by-item-and-alias item=Product6&dirtyAlias=b8895666dc-1.png'>",
image is ok
Attachment image_path.png

Yes, but what is the path saved in DB? Is it "6/..." or "yii2images/..."? In order to sort out the issue, you have to understand where the issue happens - on data save or on data load.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users