I have img tag in my view file (yii frame work). and image is displayed in most of the times. some times the images are not displaying. when I inspect the element, then it shows the img path as src="hhhh://localhost/projects/aaa/images/sample-img-left.png". here for http://, hhhh:// comes. Iam not getting any idea with how this hhhh comes. help me please
You can call Yii::app()->request->baseUrl to get the location where your project resides, then append it with the image path.
For Eg.
<img src="<?php echo Yii::app()->request->baseUrl."/images/sample-img-left.png" ?>" />
Related
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!!
Try use the base tag in the head tag or absolute path of image.
<img src = "http://localhost:8080/admin/img/prizes/testImage.jpg">
how can i set image url in page ?
In image you can see I have tried by three ways but it not work.
Images are located under image folder of active theme.
You have three image tags all pointing to different urls of which two appear malformed.
The middle image tag in your screenshot seems the most accurate but you may want to add a semicolon after the right paranthesis.
If all three files are supposed to refer to the same image, then replace the first and last image tags with the middle one.
Then if it still doesnt work then replace bloginfo('template_directory') with the actual location to the images relative to document root on the server but put the value in quotes. For example, if your images are in the subfolder images in folder imageset on your site, then you could use
"http://www.whatever.com/imageset/images" or "/imageset/images".
which results in the code:
<img src="<?php echo "/imageset/images"; ?>/images/banner1.jpg" alt="">
or even better:
<img src="/imageset/images/images/banner1.jpg" alt="">
Try as follows <img src="../images/banner1.jpg" alt="">
my image is saved in a file ....and i have saved its path in the database....when i am fetching the image path from the database and trying to display it on a given position on the web page it is simply not getting displayed instead a text "loading..." is appearing there
furthermore the inspect element is displaying the image path clearly, here it is
'<img id="image" alt="mgm axis" title="mgm axis" src="polybazaar_files/images/1.jpg" style="display: block;"></img>'
now part of my code is here
while( $result=mysqli_fetch_array($runquery))
{$GLOBALS['image']=$result['image'];}
<img src="<?php echo $image; ?>" title="<?php echo $prodname; ?>" alt="<?php echo $prodname; ?>" id="image" />
where on a different page echo'<img src="'.($result['image']).'" />'; worked for the same image on the database....
i tried the suggestion mentioned here Displaying an image using a php variable and also tried suggestion mentioned at other places but none of them work
also my page has lot of java script in between ......are they creating problem?
any valuable and informative reasons or solutions will be appreciated ....thanks
got it fixed .....
actually the address at the top of my script
<base href="http://polybazaar.in/shop/" />
needed to be put inside the comment, since i am working on a local server....or the address of a DEFAULT TARGET should be given if one wants its server request to be accessed from that URL.....
thanks all for their valuable comments
I have two files, one with HTML code when I've diferent photo albums links, example:
<a href="albumprueba.php"><img class="fancyboxi"
src="Libro Fez/Libro Fez - 001.jpg" alt="image19"
width="91%" height="56" /></a>
And another file (is php) I've a routine that scans all the photos in a folder, and shows photos:
<a class="fancyboxi" data-fancybox-group="gallery" title="Laurea"
href="Libro Fez/<?php echo $archivos[$imagen_a_empezar]?>"><img
src="Libro Fez/<?php echo $archivos[$imagen_a_empezar]?>" alt="" width="19%"/></a>
I would like to open the HTML file from an album and open a fancybox with all the photos that showing the routine in PHP file.
I've tried to do in the HTML file this, but doesn't works:
<img src="Libro Fez/Libro Fez - 001.jpg" alt="image19" width="91%" height="56" />
Any idea? thank.
Your href is certainly malformed.
albumprueba.php?Libro Fez/Libro Fez - 001.jpg
That isn't an address as URLs cannot have spaces (go to it manually and check what the address is in the navigation bar in your browser). Moreover it's just landing on a jpeg - are you sure you want this link to be to a single image?
Other than that the anchor should work. Are you getting a 404 error after following the link? If you want the other html file to be perptually viewable from the parent page you should consider using an iframe.
Im adding an image to my wordpress theme through dreamweaver cs4 and themedreamer. The image will go in the sidebar.php. When I inserted an image it doesnt shows in firefox and explorer. With safari, the image only shows an empty box with a question sign in the middle.
Is there a special way to add image in a wordpress template?
Prepend below line to images's src:
<?php echo get_bloginfo('template_url'); ?>
Making your src something like this:
<img src="<?php echo get_bloginfo('template_url'); ?>/images/yourimage.gif" alt="" />
No, but you have to get the value of the src attribute correct.