Images don't display when embedded, but do when directly visited - php

For some reason, on my server, images do not display if they're remotely (or locally) embedded in an HTML page, but they do work when visited directly.
Embed code:
<img src="http://c.beastsmc.com/banners/creative.png"/>
Here's a fiddle showing the image not displaying: http://jsfiddle.net/gKHM7/
Here's the direct image, which works: http://c.beastsmc.com/banners/creative.png
The .htaccess file is empty.
Any ideas?

As jcansyi mentioned above (upvote him!), the problem was that AdBlocker blocked the image. The reason it was blocking it was the name of the folder (banners). AdBlockPlus blocks any URL with /banners/ in it.

Related

Instagram feed image not displaying

I am successfully pulling in the url for each image for a particular tag via PHP, but the image simply will not display. I saved the image(s) off locally and it displayed just fine, but not when referencing the url in the src attribute.
<img src="http://origincache-prn.fbcdn.net/1597216_736275239737299_176271816_a.jpg" />
You can follow the above source link to the image, and this is how the img tag is set in html, but it will not display in the browser.
Any suggestions?
Thanks in advance.
I'm not sure but can this have something to do with REFERER-check?
I mean - my chrome doesn't shows up WHY the request get's blocked, when I embed it to a website.
You should figure it out (my linux-curl shows the pic with referer set, but i'm not sure if this works!).
An idea would be to provide a php-file which is just a WRAPPER for sending to image:
<?php // redirect.php
header('Location: ' . $_GET('r'));
die();
usage:
<img src="redirect.php?r=<?php echo urlencode('http://origincache-prn.fbcdn.net/1597216_736275239737299_176271816_a.jpg"');" />
Because modern browsern do not send "REFERER" when redirected through status-header 302 Redirect
just have a try...
This is possibly related--Facebook share dialogs that attempt to share images from the FB CDN origincache end up with a 500 Internal Server Error and a blank page. I know that FB throws an error when sharing other images on FB, but you usually get a descriptive error message and not just a server error.

How to retrieve and show images from another drive using src attribute in <img> tag?

<img src="d:/Tulips.jpg" >
</img>
<img src="file:///d:Tulips.jpg">
How to retrieve and show images from another drive using src attribute in <img> tag?
If the image is in the same folder it works but when the source of the image is on another drive it's not working.
jpgYou can't put your file system path in the src unless you open it from your desktop or your computer. You can try to pass the file as base64 encoded strings. I'm showing how to do it in PHP because you tagged this question with PHP
$image = file_get_contents('d:/Tulips.jpg');
$image_codes = base64_encode($image);
And in your html put it like this.
<image src="data:image/jpg;charset=utf-8;base64,<?php echo $image_codes; ?>" />
Try
<img src="file:///d:/Tulips.jpg">
You were missing a slash after your drive lettter.
The reason is you are doing the inevitable.
HTML markups cannot read data from the local disk drives, you need to put them in a folder or access it from the same directory for this to work.
Since, when you publish your website images are to be accessed from the folders of your webserver, accessing from a hard-drive directly (not possible via HTML though) puts you under potential risks.

Custom wp-content/upload image page

I've been looking for a way to make a custom direct access images on wp-content uploads folder since a year ago, but I still didn't found how to serve / display image in wp-content/uploads folder using custom script (maybe php)
Please take a look at my screensshot here : http://prntscr.com/30sdb8
you can see this wp-content/uploads are still have some additional code, and even this page source are hidden with an image (the same image)
is there anyone know how to do that on a worpdress website?
Thanks for answering my question
Updated
because of some unclearly information in my previous question here I try to explain as clear as I can.
In a default wordpress website if a user direct access an image from wp-content/uploads/ directory (for an example : www.domain.tld/wp-content/uploads/2014/04/image-name.jpg )
there will be only an image and a blank background, but in my screenshot example you can see that there are some additional code in header and footer.
my question is how to make modification like that in wordpress? so I can display a header and of footer on my wp-content/uploads/ Url pages
ps : the website I mean is lincah.com , you can go to google image, site:lincah.com then click on 1 image on the search result you'll be brought to the page I mean.
I hope thats clearly enough.
Thank you
What I could make out is you need a PHP script that could fetch all the images from uploads folder and display on the page.
<?php
$images_list = glob("wp-content/uploads/" . "*");
foreach($images_list as $image) {
echo '<img src="' . $image . '" /> <br />';
}
?>

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.

have img src = dl-main.php?f=filename.jpg retrieve said image from remote server

I am trying to do the following; dynamically pick a server with the image on it, and then show said image in img src="". Yeah I know, I am horrible at explaining stuff like this but this should clear it up:
dl-main.php (on server0.domain.com)
$url = 'http://server2.domain.com/offerimage.php?f='.$_GET["f"];
header( 'Location: '.$url ) ;
offerimage.php (on server2.domain.com)
//Lots of link-protection stuff here
$f = "/".$_GET["f"];
$url = 'http://server2.domain.com'.$uri_prefix.$m.'/'.$t_hex.$f;
echo' <img src="'.$url.'"></img> ';
dl.php (on many other servers)
img src="http://server0.domain.com/dl-main.php?f=lalala.gif"
So it pretty much goes like this: Random person adds img src directing to dl-main.php?f=filename on server0. server0 then decides which server will provide the image. In the above example I am using only one server; server2
Now I simply want dl.php to show the photo hosted on server2.domain.com .
As it stands when I directly visit dl-main.php it succesfully redirects me to dl.php, which then succesfully shows me the image I requested. But when I use dl-main.php in a img src it doesn't show the image. I didn't expect it to work but it was worth a shot, but now I don't know what to do anymore :o
I hope this failed attempt is a good example of what I'm trying to accomplish here.
Thanks!
Here's the problem. You call image from server0 using:
<img src="http://server0.whatever/dl-main.php?f=thatimage.something" />
Where the dl-main.php code redirects to server2. Here, you do:
echo' <img src="'.$url.'"></img> ';
So basically the original img tag would get another img tag instead of the image data. That's why the browser can't render the image. You should echo the content of the image instead of an img tag.
Try using your browser's developer tools and check the request to server2 to verify my guess.
It can't work, your second script (offerimage) is producing text/plain, you should produce image/...in order to use img

Categories