Image Not Showing Once Upload To A Host

Everything works fine on my localhost WAMPP, but once i upload everything to my host the created thumbnails wont show a picture, just the missing picture box. My site has an upload pictures feature for guest, the pictures upload and they are in the proper file, just wont show on the page. Here is what i have in my view to display the thumbnails. Its using CListView. I have tried basePath baseUrl and a couple others, nothing works once i upload to host. An important thing to note is that on my server I have several yii based sites using a single yii framework, with the yii framework in the root and each individual site in there own folder. Help stuck.


<?php 

//show only the images that have been crop

if(file_exists(Yii::app()->basePath.'/../images/uploads/'.$data->id.'/thumb/'.$data->image)){


?>

<div class="image-box">

   <img src="<?php echo Yii::app()->request->baseUrl.'/images/uploads/'.$data->id.'/thumb/'.$data->image  ?>" class="img-polaroid"><br/>

   <?php echo CHtml::link('<i class="icon-trash"></i>',array('site/delete','id'=>$data->id)); ?>

</div>

<?php

}elseif(!file_exists(Yii::app()->basePath.'/../images/uploads/'.$data->id.'/thumb/'.$data->image)){

    //delete the record and file fo the image that has not been cropped

    

}

?>

When I do an inspect element on where the image should be i get.


<img src="/images/uploads/79/thumb/1368910429.png" class="img-polaroid">

Which is where the image is

OTOH:

  1. can you please share the resulting HTML code of a picture that doesn’t show up?

  2. Also, are there any non-latin characters in your filenames?

  3. And have you debugged, like:




var_dump(Yii::app()->basePath.'/../images/uploads/'.$data->id.'/thumb/'.$data->image);

var_dump(file_exists(Yii::app()->basePath.'/../images/uploads/'.$data->id.'/thumb/'.$data->image));

var_dump(Yii::app()->request->baseUrl.'/images/uploads/'.$data->id.'/thumb/'.$data->image);



Wow! Thanks for your input, but i just figured it out. File Permissions!!! The directory i created to hold the thumbs was set to 700 and should have been 705. Man the little things will get you.

Hehe didn’t think about file permissions!

Hi,

You have to give permission of your folder.

check path (sometime relative path create problem+use firebug+path separator) and permission

this may help you

http://www.yiiframework.com/forum/index.php/topic/23152-relative-path-in-mainphp/