Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
New getGeographUrl function - update for passing 1M photos
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
barryhunter  
View profile  
 More options Sep 21 2008, 4:03 pm
From: barryhunter <BarryBHun...@googlemail.com>
Date: Sun, 21 Sep 2008 13:03:22 -0700 (PDT)
Local: Sun, Sep 21 2008 4:03 pm
Subject: New getGeographUrl function - update for passing 1M photos
Pretty soon we will be passing 1 million photos, (whoop!) and as such
the current folder structure for storing photos, which will while will
continue to work, is not ideal, so we are implementing a small change
to the folder structure.

This only affects people building their own url to the image file, the
API of course will simply return the appropiate url. I've previouslly
given a simple php function to calculate the url, so a new version is
included below.

So
http://s3.www.geograph.org.uk/photos/97/11/971163_f4c1bc89_120x120.jpg
becomes
http://s3.geograph.org.uk/geophotos/00/97/11/971163_f4c1bc89_120x120.jpg

and 1M will be
http://s0.geograph.org.uk/geophotos/01/00/00/1000000_xxxxxxx_120x120.jpg

NOTE: we will continue to serve existing photos on the current
structure, but images past 1M will use the new structure. And for a
time photos will be available on both, so its not urgent that you
update your code, as long as it follows the old getGeographUrl exactly
it will work even past 1M - or at least upto image id 1.1M (which is
maintained via symlinks)

... see you again when we near 100M images.... :)

======================

function getGeographUrl($gridimage_id,$hash,$size ='small') {

       $yz=sprintf("%02d", floor($gridimage_id/1000000));
       $ab=sprintf("%02d", floor(($gridimage_id%1000000)/10000));
       $cd=sprintf("%02d", floor(($gridimage_id%10000)/100));
       $abcdef=sprintf("%06d", $gridimage_id);
       $fullpath="/geophotos/$yz/$ab/$cd/{$abcdef}_{$hash}";

       $server =  "http://s".($gridimage_id%4).".geograph.org.uk";

       switch($size) {
               case 'full': return "http://www.geograph.org.uk
$fullpath.jpg"; break;
               case 'med': return "$server{$fullpath}_213x160.jpg";
break;
               case 'small':
               default: return "$server{$fullpath}_120x120.jpg";
       }


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google