Note that there are some explanatory texts on larger screens.

plurals
  1. POForming URL from string and variables
    primarykey
    data
    text
    <p>I am working on a PHP script that automatically displays an image based on certain elements (which don't matter for the sake of the question since that part works perfectly fine.) Out of the browsers I have tested it in, the images are correctly displayed on Google Chrome, Internet Explorer, and Safari. However, they do not appear on Firefox or Opera. In Firefox, nothing is displayed and in Opera the path of the image is <a href="http://server/folder/%5Cimages%5C40.jpg" rel="nofollow noreferrer">http://server/folder/%5Cimages%5C40.jpg</a> which should be <a href="http://server/folder/images/40.jpg" rel="nofollow noreferrer">http://server/folder/images/40.jpg</a>. The code used to generate the URL is as follows:</p> <pre><code> echo "&lt;div class='jumih3'&gt;" . $row['fname'] . " " . $row['lname'] . "&lt;/div&gt;"; $image = JURI::root() . "\/images\/" . $row['id'] . ".jpg"; $imagetest = JPATH_ROOT . "\/images\/" . $row['id'] . ".jpg"; if (file_exists($imagetest)) { echo "&lt;br /&gt;&lt;img src='" . $image . "'width='100' height='100' /&gt;&lt;br /&gt;"; } </code></pre> <p>This is part of a Joomla site and the JURI:root() and JPATH_ROOT provide absolute locations of the server. The way that Opera parses the URL I'm suspecting something is wrong with the way I am escaping the slashes. However, when I tried using &#47; instead of / the images did not appear in any browser. </p> <p><strong>EDIT:</strong> As you can see from Zannjaminderson's answer, the problem's fixed in a facepalm kind of way.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload