Login   Register  
PHP Classes
elePHPant
Icontem

File: doc/doc.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Luis I. Larrateguy  >  GImageGallery  >  doc/doc.txt  >  Download  
File: doc/doc.txt
Role: Documentation
Content type: text/plain
Description: Documentation
Class: GImageGallery
A gallery using a GMail account to store images
Author: By
Last change:
Date: 9 years ago
Size: 4,340 bytes
 

Contents

Class file image Download
How to use the class.

A) Quick steps for people that hate reading docs.
B) Method Listing
C) Why the option to choose between GMail's thumbs or resized in server?



A) Quick steps for people that hate reading docs.

1) Edit the config.php with your GMail "login" and the Gmail "password"
2) Instantiate the class (see example)
3) List Categories
4) List Thumbnails.
5) enjoy!

How does it works.
Gmail has implemented a system for organizing mails. A Conversation, is a
 group of messages. And a group of Conversations could be "labeled".
What does it mean? It means we can label, put an ettiquete to the 
conversations that are related.

GImageGallery looks for labels in your Gmail Account. The labels become
 "categories" in the Class. And all mails inside conversations become 
repository of photgraphies or graphics. If a mail has another attachments 
than jpg, png, gif or bmp, those attachments will be ignored.

Gimage Gallery display the subject of the mail as a "header" for the group 
of photos.


B) Method Listing

::GImageGallery(login,pass,timeZone,sessionMethod)  // constructor
::setPhotosPerRow(howMany) // set how many photos mus the gallery show per row
::showCategories() // list GMAIL labels as categories
::getThumbs(codifiedURL,maxwidth=,maxheight=) // return a thumbnail. see example and config.php
::getImage(codifiedURL) // return an Image
::setResizeMethod(resizeTipe) // see config.php
::destroyGImageGallery() //destructor for finishing the session with GMail


C) Why the option to choose between GMail's thumbs or resized in server?

The answer is simple. If we query the GMail for the complete image and we 
resize it in the server before sending it to client, we consume more 
bandwidth.
Let's see an example:
Image 18kB
GMail's thumb 4kB

1st case. If we query for the complete image.
libgmailer ask for the image (18kB incoming in the server)
GImageGallery resample image (time consuming also) and sends it to client
 (more or less 4kB outgoing)

2nd case. If we query for the GMail thumb.
libgmailer ask for the thumb (4kB incoming in the server)
GIMageGallery just sends it to client (4kB outgoing)

What are the disadvantages of the GMail's thumbs?
Well. They have a "border" around the Image and a withe background.
And if you have more than 20 pictures in the message, the ones counting 
from 20 are shown as an icon. Resize you don't have that problem... but the
 bandwidth consuming..

You choose!



-------------------------------------------------------------------
Notes (extracted from http://gmail-lite.sourceforge.net/index2.html)

GMail is a still in beta, and GMailer (along with gmail-lite above) is, I 
would say, an "alpha hack" of a beta software. So don't expect it to work 
all the time, and do not build critical mission applications upon it (e.g.
 hmm... whatever you think is important). Just have some fun, build 
something interesting from it, and hopefully make your life a bit easier 
sometimes. ;-)

Google is, IMHO, a good company. But she is NOT a charity. So let them make
 some pennies by accessing GMail through its official website, see some 
text ads, and click on them when you find them really useful or related 
(but don't click blindly: you will be misleading the "market"). That's how 
to make a good company stronger.

Finally, please just bear in mind that these kinds of hacking are actually 
violating their terms of service... so... hey, you were warned.

http://gmail.google.com/gmail/help/terms_of_use.html
-------------------------------------------------------------------

* Copyleft notice
This class has been written from scratch, unless it is said the opposite in the code or documentation.
It makes use of libgmailer (GAN Ying Hung), extending that class to provide access to thumbs.
And now, it uses Vagharshak Tozalakyan's class to resize images if wanted.


Well that's all.
Special thanks to:
*GAN Ying Hung http://gmail-lite.sourceforge.net/ (for writing libgmailer)
*DieterXP for inspiring me on using "labels" instead of "conversations" in the new version of GImageGallery. He has done excellent work with "GImage" (his product at http://www.gmailsite.com), a procedural complete solution to make an Image Gallery and now a complete site.