开发者

Facebook Image Links

I am using the following code to link to an image on Facebook:

foreach($photos["data"] as $photo)
        {echo $photo['source'];
                echo "<img src=’{$photo['source']}’ />", "<br />";
        }

The echo $photo['source'] shows the correct URL, and so does the src= in the image tag, but it tries to load from my site. So:

If the path to the image is htt开发者_开发技巧p://a1.myimagepath.jpg

It tries to load http://www.mysite.com/%E2%80%99http://a1.myimagepath.jpg

take care, lee


Your code contains curly quotes. You need to replace them with single quotes.

foreach($photos["data"] as $photo)
    {echo $photo['source'];
            echo "<img src='{$photo['source']}' />", "<br />";
    }


Try to post the URL manually:

foreach ($photos["data"] as $photo) {echo $photo['source'];
    echo "<img src=’http://a1.myimagepath.jpg’ />", "<br />";
}

You can also try without the foreach.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜