<div class="col-sm-8 col-md-6" id="upload-file-container_new">
					<?php 
$tmpArr = array();
$resArr['clad_image'] = trim($resArr['clad_image'], ',');
if ($resArr['clad_image'] != '') {
    $tmpArr = explode(',', $resArr['clad_image']);
}
$p = 1;
for ($i = 0; $i < 8; $i++) {
    ?>
						
						<?php 
    if (!empty($tmpArr) && isset($tmpArr[$i])) {
        echo '<div class="upload-file-containercls">';
        $isimg = true;
        echo '<img class="adImg newadimg ad-image' . $p . '" src="' . image(clad_img_path() . $tmpArr[$i]) . '" imgid="' . $tmpArr[$i] . '"/><center><i class="glyphicon glyphicon-trash delimgnew"></i></center>';
        echo '</div>';
        $p++;
    }
    ?>
						

						<!--<img src="<?php 
    echo public_path();
    ?>
frontside/img/uploadico.png" class="up-image-iconimg" style="<?php 
    echo $dispnone;
    ?>
" />
						
						
                  </tr>
                </thead>
                <tbody>
				<?php 
    foreach ($clad_ads as $ads) {
        $image = explode(',', @$ads->clad_image);
        ?>
                  <tr>
                    <td class="col-sm-8 col-md-6">
                      <div class="media">
                        <a class="thumbnail pull-left" href="<?php 
        echo createUrl("detail", array(@$ads->clad_id, @$ads->clad_title));
        ?>
">
                          <img class="media-object" src="<?php 
        echo image(clad_img_path() . $image[0], "search_ad");
        ?>
"/>
                        </a>
                        <div class="media-body">
                          <h4 class="media-heading"><a href="<?php 
        echo createUrl("detail", array(@$ads->clad_id, @$ads->clad_title));
        ?>
"><?php 
        echo @$ads->clad_title;
        ?>
</a></h4>
                          <p><small><?php 
        echo @$ads->clad_title;
        ?>
</small></p>
    //echo BASEPATH."../uploads/ad/".$image[0];die;
    if (!file_exists(BASEPATH . "../uploads/ad/" . $image[0])) {
        continue;
    }
    if ($cnt == 10) {
        break;
    }
    ?>
			  <div class="thumbnail">
				<div class="home-product">
					<a href="<?php 
    echo createUrl("detail", array(@$product->clad_id, @$product->clad_title));
    ?>
">
						<img src="<?php 
    echo image(clad_img_path() . $image[0], "home_ad");
    ?>
" class="img-responsive" onerror="this.onerror=null;this.src='<?php 
    echo public_path();
    ?>
frontside/img/noimage-120x120.jpg'"/>
					</a>
				</div>
                <div class="caption">
                  <p><small><a href="<?php 
    echo createUrl("detail", array(@$product->clad_id, @$product->clad_title));
    ?>
">
                  <?php 
    $title = strtolower(@$product->clad_title);
    if (strlen($title) > 30) {
 public function uplodeimage()
 {
     if (isset($_FILES) && $_FILES['image']['name'] != '') {
         $config['upload_path'] = DOC_ROOT_CLASSIFIED_AD;
         $config['allowed_types'] = 'gif|jpg|png|bmp|jpeg';
         $config['file_name'] = time() . rand(1, 999);
         $this->load->library('upload', $config);
         $path_parts = pathinfo($_FILES["image"]["name"]);
         $imgName = $config['file_name'] . '.' . $path_parts['extension'];
         //$imgName = $config['file_name'];
         if (!$this->upload->do_upload('image')) {
             $error = $this->upload->display_errors();
         }
         dowatermark($config['upload_path'] . $imgName);
         if ($error != "") {
             $messages['imgname'] = $error;
             $result['status'] = "204";
             $result['message'] = $error;
             $result['data'] = $messages;
             return $result;
         }
         $messages['image_name'] = $imgName;
         $messages['ad_thumb_image'] = image(clad_img_path() . $imgName, 'm_thumb');
         $messages['ad_main_image'] = clad_img_path() . $imgName;
         $result['status'] = "200";
         $result['message'] = "Image successfuly completed";
         $result['data'] = $messages;
         return $result;
     } else {
         $result['status'] = "204";
         $result['message'] = "Please enter valid data";
         $result['data'] = array();
     }
 }
function generateBlockHtml($myAdArr, $categories, $flg)
{
    ?>
    <div class="col-lg-12">
        <div class="table-responsive">
        <table class="table table-hover">
            <thead>
                <tr>
                    <th>Ads Products</th>
                    <th class="text-center">Price</th>
                    <th class="text-center">Views</th>
                    <th class="text-center">Edit</th>
                    <?php 
    if ($flg == 'inactive') {
        echo '<th class="text-center">Delete</th>';
    }
    ?>
                </tr>
            </thead>
            <tbody>
                <?php 
    //pr($myAdArr,9);
    foreach ($myAdArr as $k => $v) {
        $v->clad_image = trim($v->clad_image, ',');
        $image = explode(',', @$v->clad_image);
        $tmpcat = array_filter(explode("-", $v->clad_category));
        $last = end($tmpcat)['cat_id'];
        $tmpcat = array_map(function ($cat) use($categories, $last) {
            if ($cat == $last) {
                return "<a href='" . base_url() . "classified/search?category=" . $categories[$cat]['cat_id'] . "'>" . $categories[$cat]['cat_name'] . "</a>";
            } else {
                return "<a href='" . createUrl("category", array($categories[$cat]['cat_id'], $categories[$cat]['cat_name'])) . "'>" . $categories[$cat]['cat_name'] . "</a>";
            }
        }, $tmpcat);
        $tmpcat = implode(" > ", $tmpcat);
        //pr($image,9);
        ?>
                    <tr>
                        <td class="col-sm-8 col-md-6">
                            <div class="media">
                                <a class="thumbnail pull-left" href="<?php 
        echo createUrl("detail", array(@$v->clad_id, @$v->clad_title));
        ?>
">
                                    <img style="height:120px;width:120px;" height="120" width="120" class="media-object" src="<?php 
        echo image(clad_img_path() . $image[0]);
        ?>
" onerror='this.onerror=null;this.src="<?php 
        echo public_path();
        ?>
frontside/img/noimage-120x120.jpg"'/>
                                </a>
                                <div class="media-body">
                                    <h4 class="media-heading"><a href="<?php 
        echo createUrl("detail", array(@$v->clad_id, @$v->clad_title));
        ?>
"><?php 
        echo @$v->clad_title;
        ?>
</a></h4>
                                    <p><small><?php 
        echo @$v->clad_description;
        ?>
</small></p>
                                    <p class="brand-name"><?php 
        echo $tmpcat;
        ?>
 <b> > <?php 
        echo $v->clad_city;
        ?>
</b></p>
                                    <p>Posted On <?php 
        echo date('jS F,Y - h:i A', strtotime(@$v->clad_created_date));
        ?>
</p>
                                    <?php 
        if ($flg == 'active') {
            ?>
                                        <p>Expire On <?php 
            echo date('jS F,Y - h:i A', strtotime(@$v->clad_expiry_date));
            ?>
</p>
                                    <?php 
        }
        ?>
                                </div>
                            </div>
                        </td>
                        <td class="col-sm-1 col-md-1 text-center" style="vertical-align: middle;"><strong><?php 
        echo @$v->clad_price;
        ?>
 INR</strong></td>
                        <td class="col-sm-1 col-md-1 text-center" style="vertical-align: middle;"><?php 
        echo @$v->clad_total_views;
        ?>
</td>
                        <td class="col-sm-1 col-md-1 text-center" style="vertical-align: middle;font-size:25px;"><a href="<?php 
        echo base_url() . 'myaccount/editAd/' . $v->clad_id;
        ?>
"><i class="fa fa-edit"></i></a></td>
                        <?php 
        if ($flg == 'inactive') {
            ?>
                            <td class="col-sm-1 col-md-1 text-center" style="vertical-align: middle;font-size:25px;"><a href="<?php 
            echo base_url() . 'myaccount/deleteAd/' . $v->clad_id;
            ?>
"><i class="fa fa-trash-o"></i></a></td>
                            <td class="col-sm-1 col-md-1 text-center" style="vertical-align: middle;">
							<?php 
            if ($v->clad_active == 0) {
                ?>
								<a href="<?php 
                echo base_url() . 'myaccount/makeAdActive/' . $v->clad_id . '/1';
                ?>
">Make Active</a>
							<?php 
            } else {
                echo "<b>Waiting for Approval</b>";
            }
            ?>
							</td>
                        <?php 
        }
        ?>
                        <?php 
        if ($flg == 'active') {
            ?>
                            <td class="col-sm-1 col-md-1 text-center" style="vertical-align: middle;"><a href="<?php 
            echo base_url() . 'myaccount/makeAdActive/' . $v->clad_id . '/0';
            ?>
">Deactivate Ad</a></td>
                        <?php 
        }
        ?>
                    </tr>
                <?php 
    }
    ?>
            </tbody>
        </table>
            </div>
    </div>
    <?php 
}
									<a class="thumb_img_a" href="<?php 
        echo createUrl("detail", array(@$ads->clad_id, @$ads->clad_title));
        ?>
">
										<img src="<?php 
        echo image(clad_img_path() . $image[0], "search_ad");
        ?>
" alt="<?php 
        echo @$ads->clad_title;
        ?>
" onerror="this.onerror=null;this.src='<?php 
        echo public_path();
        ?>
frontside/img/noimage-120x120.jpg'" class="group list-group-image">
										<!--<img src="<?php 
        echo clad_img_path() . $image[0];
        ?>
" alt="<?php 
        echo @$ads->clad_title;
        ?>
" onerror="this.onerror=null;this.src='<?php 
        echo public_path();
        ?>
frontside/img/noimage-120x120.jpg'" class="group list-group-image" />-->
									</a>
									<div class="caption pull-left caption-height">
										<h4 class="group inner list-group-item-heading">
											<a class="" href="<?php 
        echo createUrl("detail", array(@$ads->clad_id, @$ads->clad_title));
        ?>
">