Image not showing in chrome. It shows only in firefox - php

I have a problem with my website. Have defined image on index. Image shows only in firefox. In chrome it doesn't show and I don't know why.. Can anybody help me? Thank you
index.php
<div id="advert">
<img src="img/advertisement/topbanner.jpg" alt="MyWebsite" title="MyWebsite" />
</div> <!-- advert -->
CSS
#advert {
height:200px;
width:460px;
}

Sounds like an adblocker-problem. Try to rename the folder "advertisement" and/or the id "advert" into something like foo check if it works then.

Since the code is fine, my guess would be that the image has been saved in CMYK format, instead of RGB.
Or an ad blocker. Since you have an id of advert, this will of course be blocked by an adblocker.

place (../image folder/ image name)[ ../ infront of folder name]

Related

Getting large thumbnail photos from Instagram is no longer working with "replace"

For long time I use this "replace function" to get the thumbnails by Instagram API, it worked well but now they changed somethings and I no longer to use bigger thumbnails by this way.
src="<?= str_replace('s150x150/', 's320x320/', $post->images->thumbnail->url) ?>">
By default thumbnail, it works well.
https://scontent.cdninstagram.com/vp/94387bd7b8a247f3f4039f8789772142/5AEE2A9E/t51.2885-15/s150x150/e35/c0.135.1080.1080/26335890_2247807142112483_5882778660510892032_n.jpg
But replaced thumbnail size to bigger, it appears a msg: Invalid URL signature.
https://scontent.cdninstagram.com/vp/94387bd7b8a247f3f4039f8789772142/5AEE2A9E/t51.2885-15/s320x320/e35/c0.135.1080.1080/26335890_2247807142112483_5882778660510892032_n.jpg
Anyone can help to get bigger thumbnail of Instagram. They changed API and I feel so tired with Facebook, they have made many changes since sync with FB and everytime like this, the developers have to update with no instructions.
You can try with this trick
src="<?= str_replace('s150x150/', 's320x320/', str_replace('vp/', '', $post->images->thumbnail->url)) ?>">
or
src="<?= str_replace('s150x150/', 's640x640/', str_replace('vp/', '', $post->images->thumbnail->url)) ?>">
You have to replace (delete) also "vp/" on url, and works again.
It's a really bad solution, but it's the only that i've found.
Copy the link of the profile pic after the "/s150x150/xxxxxxxx......jpg" to the end of this:
"https://instagram.flju2-1.fna.fbcdn.net/vp/e890a9f0b7b40abe5667b06d0fa750e5/"
like: https://instagram.flju2-1.fna.fbcdn.net/vp/e890a9f0b7b40abe5667b06d0fa750e5/xxxxxxxx......jpg
Works right now.
A solution would be very nice!
I have also done it like you the last few month.
I think one of the solutions is to use non-squared fotos from instagram (you get with "standard_resolution") and set it as a background-image and do the "square" via css and display cover… 
This is my personal solution at the moment… 
i opened instagram on google chrome selected the desired post, right-clicked to "save as". after opening the saved html doc. in chrome i right-clicked again to veiw page source. i scrolled down to line 217 of the page source and one of the links there gave me the picture i wanted. not sure that it is the same thing as before but it let me download the picture of the post in a .jpg format. hope this helps

Display an image based on visited base url

Right, so this is a really simple - and likely somewhat stupid one. Apologies in advance.
I've got a site that has three URLs that go to the same site. Web server is apache, virtual host is done proper with StieAlias(es) so that if someone visits the site via URL1.com, the browser just sees URL1.com and then URL2.com, URL3.com - you get the idea.
Now the issue is the user wants to display a certain logo based on the base URL. So if they do:
www.URL1.com --> logo1.gif
www.URL2.com --> logo2.gif
www.URL3.com --> logo3.gif
Totally elementary, but I've never done it before. Site is PHP and I'm decent enough with PHP I suppose but I've got no idea even where to start on this one.
TIA.
You could do that with some javascript code:
<script type="text/javascript">;
var host = location.host;
// here we use the location to build the image name
// for example, for stackoverflow the image name would be: `stackoverflow.com.jpg`
document.getElementById('myImage').src = host+'.jpg';
</script>
and then in your html use:
<img id="myImage" src="" />
Check this JSFiddle that I've created for you. You can inspect the image element and check its source.
Assuming your logo file is located in the images folder with the file name URL1-logo.png.
PHP
$mylogotoload = $_SERVER['SERVER_NAME'];
echo '<img src="images/'.$mylogotoload.'-logo.png" />';

Html image source from a local folder on windows options

On my html page, I make use of images which are housed in a local folder. The paths are coming directly from the database field. How can I do this? I know it wont work if the images are not in the web root directory. Can symlinks work?
For example,
The physical path to the images is c:/Images and the database field will contain the path like this, photo/image1.jpg
I will fetch the image source path from php as shown below,
<img id="image1" src="<?php echo $this->object->imagePath; ?>" class="img-polaroid">
$this->object->imagePath here will be the string concatenation of c:/Images and photo/image1.jpg. So, putting it together t will be c:/Images/photo/image1.jpg
The problem is it does not show up. I have tried this as well to test,
<img id="image1" src="file:///C:/Images/photo/image1.jpg" class="img-polaroid">
But no luck.
first let me know if putting just C:/Images/photo/image1.jpg in a browser address bar brings an image or not. If not then that's mean you are giving wrong path. Let me know so i can edit this answer. But for now this is the answer i hope.
Symlink to the folder worked like a charm.

adding a background-image to body in a cakephp layout with jQuery

I'm using cakephp 2 and I'm trying to allow my users to upload an image which is then used as the background for their page.
I have the images uploading fine and saving to a (webroot)files/User/$userid/$bodybgimage. I've also got the name of the image in the database.
Trouble is I want because I don't know in advance what user id is going to be requesting their background image I can't put their background in the stylesheet, so I'm trying to get it added in the default layout. I've tried to add with jquery: (the image filename is in $bodybgimage)
<?php if(!$bodybgimage == '') {?>
$('body').css('background-image', 'url('<?php echo '../files/User/'.$userId.'/'.$bodybgimage; ?>')');
<?php }?>
But this seems to just remove everystyle I had for the body!
I also tried doing adding it straight to the body tag like so:
<body<?php if(!$bodybgimage == '') echo ' style="background-image:url(../files/User/'.$userId.'/'.$bodybgimage.')"';?>>
But again to no avail. Can anyone help me out. I know the image and all's there because if I put the background-image style in the stylesheet the image pops up ok. There must be a sensible way to do this that I'm missing. Plz help!
Please can you try to omit the "../" before the files as i assume that your images founded in a folder named files beside your script not ?

Strange black line under Wordpress logo

I am building my own website using Wordpress. When I was using a PNG picture(140*82 px) instead of the default "site-title" as my site logo, I got a really strange result. The picture is presented nicely, but there is a black line just under the picture. I have checked my "header.php" and "style.css" file, nothing wrong there. I also used Chrome "Inspector" to check the logo, it said: img 140*83( natural 140*82 ).
So, where does this line come from? Thanks, guys!
Here is my logo section in "header.php":
<<?php echo $heading_tag; ?> id="site-title">
<span>
<img src="http://118.228.173.234/wp-content/uploads/logo.png" width = "140" height = "82">
</span>
</<?php echo $heading_tag; ?>>
It's gotta be CSS related then. Check if you have reference to span in your CSS and locate the black #000 or #000000. Hard to tell without seeing more code at this point. Check for #site-title in CSS also.

Categories