Question

I have an image with a blank space in it. On some pages, it works fine. On others, it cuts off where the blank space is. Is there a reason why it works sometimes and not others?

the same image... I get this on one page (incorrect):

  • <img src="/assets/848b31ff/thumb_4307-0403141" large.jpg="">
$thumb = Yii::app()->assetManager->publish(Yii::app()->basePath.'/images/'.$data->product->product_image);
<? echo '<a href="'.$url. '"><img src ='.$thumb.'><b>'.$prodname.'</b></a>';?>

And this on another (correct):

  • <img src="/assets/848b31ff/thumb_4307-0403141 large.jpg" class="thumb-product" border="0" alt="">
if(is_file($img_path.$model->product_image) && is_file($thumb_path.$model->product_image)){
 $product_imaget = Yii::app()->assetManager->publish(Yii::app()->basePath.'/images/'.$model->product_image);
      }
Was it helpful?

Solution

You are missing enclosing quotes in the first echo on the src param. This is how it should be:

<? echo '<a href="'.$url. '"><img src ="'.$thumb.'"><b>'.$prodname.'</b></a>';?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top