Coding, Programming & Algorithms, Tips, Tweaks & Hacks
If you want to check if a file exists publically on Google Cloud Storage,
<?php $flyer = "http://commondatastorage.googleapis.com/bucket/path/to/directory/image.jpg"; $headers = @get_headers($flyer); if ($headers[0] != "HTTP/1.1 200 OK" && $headers[0] != "HTTP/1.0 200 OK") { # Load file locally / from elsewhere $flyer = IMG."/image.jpg"; }?>
No comments:
Post a Comment