Fer VT
Fer VT

Reputation: 508

img src not working for some cases

what i'm basically doing is to save some images within some directory of my localhost, the problem is when i try to show them. But here's the thing:

In my directory i have two exact images, named differently, one is named based on a unique name generated, and the other is named as it would normally be named.

For example:

Image No. 1 is called: o9z2z2f545faf1d1.jpg

Image No. 2 is called: testImage.jpg

When i want to show them i normally do it this way

<img src = "<?php echo $prize['Prize']['imageUrl']; ?>">

If i inspect the element i get "http://localhost:8080/admin/img/prizes/o9z2z2f545faf1d1.jpg"

If i do it this way it doesnt show anything.

But if i do this

<img src = "../../img/prizes/testImage.jpg">

And then if i inspect the element it gives: "http://localhost:8080/admin/img/prizes/testImage.jpg"

I check on the folder where the images are saved, and they look fine. its when i get to call them by the unique name that fails

How can i solve this?

Thank you very much!!

Upvotes: 1

Views: 332

Answers (1)

marcollahc
marcollahc

Reputation: 46

Try use the base tag in the head tag or absolute path of image.

<img src = "http://localhost:8080/admin/img/prizes/testImage.jpg">

Upvotes: 1

Related Questions