1

I wish to insert HTML formatted card in Google Glass timeline using Mirror API. I am using PHP PHP Mirror Client API. It takes message and image as argument, and displays that image in the background. Something like this:

 insert_timeline_item($mirror_service, $new_timeline_item, "image/jpeg", file_get_contents($image_url));

Any help about using custom card views with PHP Client library would be highly regarded. Thanks.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
Lubna
  • 151
  • 9

1 Answers1

2

The custom card views would be expressed by the HTML that you have set in the $new_timeline_item variable.

You can design the HTML using the Mirror API Playground at https://developers.google.com/glass/tools-downloads/playground

You would set this into the $new_timeline_item variable with something like

$html = '<article class="photo">'.
        '  <img src="attachment:0" width="100%" height="100%">'.
        '  <div class="overlay-gradient-tall-dark"/>'.
        '  <section>'.
        '    <p class="text-auto-size">Based on Hybrid Template</p>'.
        '  </section>'.
        '</article>';
$new_timeline_item->setHtml( $html );

The img URL of "attachment:0" means to use the first attachment as the image. The rest of the HTML was based on the HTML generated by the "Hybrid" template on the Playground - you can adjust as necessary.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • This is great! I wonder how i missed that part! Thank you! Where can I find detailed documentation about PHP Client library? I wish to add a custom footer with time stamp and a logo as well. I am using
    tag in html like:
    but it is not formatted correctly.
    – Lubna Mar 31 '14 at 05:24
  • Both of these sound like separate questions that are best posted separately so they're not mixed up with the original question. – Prisoner Mar 31 '14 at 12:38