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.
Related
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
I'm completely new to php but managed to find a script that will produce the HTTP/1.0 401 Unauthorized message box
This is the message box:
I've heard and seen that you can make this message box be sent through an image. How do i go about doing that?
When done, the steps should be:
I post image.jpg
The authentication message shows up
I know it involves me having a website (example.com). Then on the website i have a folder (example.com/folder) and in that folder i have the image (example.com/folder/image.jpg). What php script do i put in the folder that will result in the image generating the authentication message?
As said before in comments, it has nothing to do with PHP.
The button in your example just set the image URL. But that URL is protected by HTTP Basic Authentication.
To do this just create 2 files in the image folder : .htaccess and .htpasswd
And add HTML and Javascript code like the one on the website :
<img src="" id="downloadImg" alt=""/>
<input type="button" value="Display Image" id="displayImage" onclick="document.getElementById('downloadImg').src='/protected-folder/image.jpg';"/>
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.
I'm trying to integrate facebook share by using images directly from my database.
Static images using the OG tags:
<meta property="og:image" content="http://X.com/image.jpg" />"
Works fine.
However, my images are not static, they are being called from my database using this:
echo "<img src=\"pic.php?id=".$id."\"/>";
Where pictures render fine on my website but facebook share does not pick them up.
The logical thing in my mind then would be to do this:
echo "<meta property=\"og:image\" content=\"http://X.com/pic.php?id=".$id."\"/>";
Sadly, this does not work.
Any ideas?
I suggest you use a URL rewrite to create a friendly URL, e.g.
http://x.com/pic/id
If you are using Apache, that would be a .htaccess file (assuming you have mod_rewrite enabled), something like:
RewriteEngine on
RewriteRule ^pic/([^/\.]+)/?$ /pic.php?url=$1 [L]
Same problem for me using asp
Image is retrieved from MySQL blob field by asp script.
the debugger shows the image and gives no error but the button on the page doesn't take the image.
And it should have nothing todo with caching as it is a brand new page.
Page: http://www.ffkama.be/html/2_agenda_detail.asp?ps=id51
Image URL: http://www.ffkama.be/root/imager_ag.asp?id=51
UPDATE: I forgot the code in the HEAD TAG :( One thing is sure, without the 'prefix="og: h t tp://ogp.me/ns# fb: ht tp://ogp.me/ns/fb# website: h t tp://ogp.me/ns/website#"' in the HEAD Tag, the debugger doesn't give an arror and the image shows up in the dubugger but the image won't show up on your page. Then the page is cached and there are only 2 solutions: 1. rename the page 2. wait several days for the cache to expire
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