mercredi 16 octobre 2019

how to display image with db stored path

I am creating a tool in which user uploads an image or gives an external link of image. so I am storing that image url in my database. if a user uploads image then I am storing full path of the file eg:

C:\xampp\htdocs\project\public\upload/1571149288.jpg

and if the user is giving me an image url

eg:

https://example.com/images/ask1571149288e.jpg. 

I am storing this full path, in next screen i need to display last three images that user uploaded, in any using db stored path,

Contoller

$previousUpload = DB::table('background_trimmer')->where('user_id',1)->limit(3)->orderBy('id', 'desc')->get();

    return view('user.clippingMagic.upload', array('previousUpload'=>$previousUpload));

Blade View

    <div id="recent-images" class="mt-3">
     @foreach ($previousUpload as $recentImage)
         <div class="recentimages">
             <img src="..\" alt="image recent" />        

        </div>
      </div>
 @endforeach
</div>

getting 404 for image and the image src is now => http://127.0.0.1:8000/C:\xampp\htdocs\New folder\marketermagic\public\upload/1571206254images.jpg

what i want it

C:\xampp\htdocs\New folder\marketermagic\public\upload/1571206254images.jpg

if i hit C:\xampp\htdocs\New folder\marketermagic\public\upload/1571206254images.jpg this url in a browser tab i have the image. thanks for any help



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2MDSVDu
via IFTTT

Aucun commentaire:

Enregistrer un commentaire