Retina iconLink with Google Drive API

I get a list of files in a folder. The response contains iconLink for each returned file. This icon has 16x16 pixels.

Does anyone know a way to get a retinal image? Or another way to get a larger icon image?

https://developers.google.com/drive/v2/reference/files

top : Google Drive user interface

bottom : Google Drive API Integration

Example

+7
php google-drive-sdk
source share
2 answers

The good news is that although a non-documented driver has badges with a 2-digit resolution. The bad news is that there are inconsistent file names; for example, the icon you linked in the comments has a 32px version of availabel here: ssl.gstatic.com/docs/doclist/images/mediatype/icon_3_pdf_x32.png

Now here is my solution, it is not perfect, but it will do this work for a while:

 function getIcons($file_type) { $icons = [ 'pdf' => [ 'icon' => 'icon_12_pdf_list.png', 'retina' => 'icon_3_pdf_x32.png' ], 'document' => [ 'icon' => 'icon_1_document_x16.png', 'retina' => 'icon_1_document_x32.png' ], 'image' => [ 'icon' => 'con_1_image_x16.png', 'retina' => 'icon_1_image_x32.png' ], 'word' => [ 'icon' => 'icon_1_word_x16.png', 'retina' => 'icon_1_word_x32.png' ], 'text' => [ 'icon' => 'icon_1_text_x16.png', 'retina' => 'icon_1_text_x32.png' ], 'spreadsheet' => [ 'icon' => 'icon_1_spreadsheet_x16.png', 'retina' => 'icon_1_spreadsheet_x32.png' ], 'form' => [ 'icon' => 'icon_2_form_x16.png', 'retina' => 'icon_2_form_x32.png' ], 'audio' => [ 'icon' => 'icon_1_audio_x16.png', 'retina' => 'icon_1_audio_x32.png' ] ]; return isset($icons[$file_type]) ? $icons[$file_type] : $icons['text']; } 

Reasion I say that this will work for a while, so that I am considering the _3_ file _3_ in pdf format, for example, the version number. Therefore, if Google updates its badges again in the future, this decision may be blocked.

+3
source share

It looks like images with x128 are also added / present for different versions:

Ver. one

Ver. 2

Ver. 3

It is better to replace x16 on the extracted iconLink and replace it with x128 .

0
source share

All Articles