My php code seems correct, (the part that talks to blob storage).
//talk to blob storage, get links, based on file name
$storageClient = $this->azure->get_blob_storage();
foreach($result as $photo)
{
$sharedAccessUrl[] = $storageClient->generateSharedAccessUrl(
'container',
$photo['File'],
'b',
'r',
$storageClient ->isoDate(time()),
$storageClient ->isoDate(time() + 3000)
);
}
foreach($sharedAccessUrl as $item)
{
$pictures[] = $item;
}
This gets all the absolute url links, I then store it inside an array, pass it to the view and retrieve the images. Like this:
<img src="<?php echo $pictures[$i]; ?>" height=100px width="100px">
(where pictures[$i] = http://azure blobstorage etc...
On my local machine, everytime I refresh the page, or flick through pages where there are images, they all load up fine. However, when I upload my app onto azure web-sites, often I get broken images, and will then need to "refresh the page" every time it happens for the image to appear. This is despite the link to the image being correct, after I click on inspect element on the div where the image is suppose to appear.
I am using "shared version" of azure web sites from the 3 month trial. PHP version is exactly the same as my local machine, along with the .net framework.
Does anyone have any idea why this is happening?
I have checked the logs but they are not helpful.
Solution:
There seems to be a delay with the times set at blob storage and azure web sites.
$storageClient ->isoDate(time()-60),
$storageClient ->isoDate(time() + 3000)
add -60 to the first line. And it should work.