Friday, 17 August 2018

Php image response appear as 0x0 pixels

I CANNOT CREATE ANYMORE QUESTIONS IDK WHY SO RESTRICT ME TO SO I'VE EDITED THIS ONE

I have an button with onclick function that sends id of current record and retrieves the images of that certain record

View

<button class = 'btn btn-success' onclick = "showPhotoModal('');" 
data-toggle="modal" data-target="#modal"><i class = 'fa fa-picture-o'></i></button>

Script

function showPhotoModal(id){
$.ajax({url:"", type:"get", data:"image=" + id, success:function(data)
{
  $("#photo_container").html(data);
}
});
}

Controller

if($request->has('image')):
        $temp       =   DB::table('base_product_images')
                        ->where('product_id','=', $request->input('image'))
                        ->get();

        $count      =   count($temp);

        $ctr        =   1;
        if($count > 0):
        $html       =   '<div class="slideshow-container">';
        $bullets    =   '<div style="text-align:center">';
            foreach($temp as $row):
                $path   =   url("uploads/base_products/" . $request->input("image") . "/" . $row->img);
                $html   .=  '<div class="mySlides fade">
                            <div class="numbertext">1 / 3</div>
                            <img src="' . $path . '" style="display:block !important;vertical-align: middle;" class = "imgs">
                            <div class="text">' . $ctr . '/' . $count .'</div>
                            </div>';
                $bullets.=  '<span class="dot" onclick="currentSlide(' . $ctr . ')"></span>';
                $ctr ++;
            endforeach;
        $html       .=  '<a class="prev" onclick="plusSlides(-1)">&#10094;</a><a class="next" onclick="plusSlides(1)">&#10095;</a></div><br>' . 
                        $bullets . '</div>';

        return $html;
        endif;
    endif;

As show on this image. It fetches results.

In network tab

But when in view in my modal that it should be appeard it looked like this (Only the bullet elements are displayed, it is also from the response)

Bullets

But when i inspect the element i found my whole response tags and images but it appears as 0x0 pixels

enter image description here



from Php image response appear as 0x0 pixels

No comments:

Post a Comment