wiki:Modules/PhotoLibrary

 PhotoLibrary

Introduction

The photolibrarycan handles libraries - user or global created ones - with pictures. Pictures can be uploaded as jpg, gif, png as single files or as a collection in a zip file. All pictures will be resized to a given value when creating the photolibrary. Thumbnails will also be created.

MainEntries

The main entry in the photolibrary is the definition of it. It holds a name/description, a connection to the user who created it (user photo libraries), the size of the preview and of the full size pictures. There is no element right checking available for the photolibrary. All rights are handles using function authorities (User photolibraries are the ones where the global flag is off):

PHOTOLIBRARY_VIEW View global photolibraries and pictures
PHOTOLIBRARY_MAINCREATE create global photolibraries
PHOTOLIBRARY_MAINDELETE delete global photolibraries
PHOTOLIBRARY_MAINMODIFY modify global photolibraries
PHOTOLIBRARY_CREATE add pictures to global photolibraries
PHOTOLIBRARY_DELETE delete pictures from global photolibraries
PHOTOLIBRARY_MODIFY modify description/name of pictures from global photolibraries
PHOTOLIBRARY_USERMAINMANAGE create/modify user photolibraries and manage pictures (your own)
PHOTOLIBRARY_USERVIEW view your own photolibraries
PHOTOLIBRARY_ALLUSERVIEW view libraries from other users |
PHOTOLIBRARY_ALLUSERMANAGE manage photolibraries (create/delete/..) from other users

Entries

An entry is a picture in the photolibrary.

Package

PhotoLibrary

 JavaDoc

Parameter Prefix

PhotoLibrary

 getMainEntries

Retrieve all photolibraries.

Authorities

  • PHOTOLIBRARY_VIEW
  • PHOTOLIBRARY_USERVIEW
  • PHOTOLIBRARY_ALLUSERVIEW

Parameter

required

none

optional

photolibraryView.personal true/false get only personal photolibraries if set to true
photolibraryView.randomPictures 0-n number of how many random pictures of the photolibrary should be included in the output

return tree

<PHOTOLIBRARY>
  <MAINENTRY>
    <ID>1155931586195</ID>
    <NAME>Ski Tour 2006</NAME>
    <DESCRIPTION>A great week in the Mountains of Salzburg</DESCRIPTION>
    <PREVIEWWIDTH>100</PREVIEWWIDTH>
    <PREVIEWHEIGHT>-1</PREVIEWHEIGHT>
    <FINALWIDTH>600</FINALWIDTH>
    <FINALHEIGHT>-1</FINALHEIGHT>
    <OWNER>
      <ID>2</ID>
      <NAME>admin</NAME>
    </OWNER>
    <PERSONAL>false</PERSONAL>
    <NUMPHOTOS>12</NUMPHOTOS>
    <CHANGE>
      <DATE>08/18/2006 20:06</DATE>
      <LDATE>1155931586247</LDATE>
      <USER>
        <NAME>admin</NAME>
        <ID>2</ID>
        <IP>81.223.9.190</IP>
      </USER>
    </CHANGE>
    <ENTRY>
      <ID>1155932239117</ID>
      <NAME>177_7796.JPG</NAME>
      <EXT>JPG</EXT>
      <THUMBNAIL>/photos/1155931586195/1155932239117tn.JPG</THUMBNAIL>
      <IMAGE>/photos/1155931586195/1155932239117.JPG</IMAGE>
      <ORIGINAL>/photos/1155931586195/1155932239117orig.JPG</ORIGINAL>
      <FILESIZE>870241</FILESIZE>
      <DESCRIPTION />
      <DATE>08/18/2006 20:19</DATE>
      <LDATE>1155932350655</LDATE>
    </ENTRY>
  </MAINENTRY>
  ...
  <ALBUMWEBPATH>/photos/</ALBUMWEBPATH>
</PHOTOLIBRARY>

Example

see HowTo/en/Implementation/Webalbum%20%28Photolibrary%29%20with%20Oberserver%20Design?

 getMainEntry

get a single photolibrary with random pictures

Authorities

  • PHOTOLIBRARY_VIEW
  • PHOTOLIBRARY_USERVIEW
  • PHOTOLIBRARY_ALLUSERVIEW

Parameter

required

photolibraryView.mainId The id of the photolibrary

optional

photolibraryView.randomPictures 0-n number of how many random pictures of the photolibrary should be included in the output

return tree

<PHOTOLIBRARY>
  <MAINENTRY>
    <ID>1155931586195</ID>
    <NAME>Ski Tour 2006</NAME>
    <DESCRIPTION>A great week in the Mountains of Salzburg</DESCRIPTION>
    <PREVIEWWIDTH>100</PREVIEWWIDTH>
    <PREVIEWHEIGHT>-1</PREVIEWHEIGHT>
    <FINALWIDTH>600</FINALWIDTH>
    <FINALHEIGHT>-1</FINALHEIGHT>
    <OWNER>
      <ID>2</ID>
      <NAME>admin</NAME>
    </OWNER>
    <PERSONAL>false</PERSONAL>
    <NUMPHOTOS>12</NUMPHOTOS>
    <CHANGE>
      <DATE>08/18/2006 20:06</DATE>
      <LDATE>1155931586247</LDATE>
      <USER>
        <NAME>admin</NAME>
        <ID>2</ID>
        <IP>81.223.9.190</IP>
      </USER>
    </CHANGE>
    <ENTRY>
      <ID>1155932239117</ID>
      <NAME>177_7796.JPG</NAME>
      <EXT>JPG</EXT>
      <THUMBNAIL>/photos/1155931586195/1155932239117tn.JPG</THUMBNAIL>
      <IMAGE>/photos/1155931586195/1155932239117.JPG</IMAGE>
      <ORIGINAL>/photos/1155931586195/1155932239117orig.JPG</ORIGINAL>
      <FILESIZE>870241</FILESIZE>
      <DESCRIPTION />
      <DATE>08/18/2006 20:19</DATE>
      <LDATE>1155932350655</LDATE>
    </ENTRY>
  </MAINENTRY>
  <ALBUMWEBPATH>/photos/</ALBUMWEBPATH>
</PHOTOLIBRARY>

 getEntries

Get a single photolibrary with all pictures.

Authorities

  • PHOTOLIBRARY_VIEW
  • PHOTOLIBRARY_USERVIEW
  • PHOTOLIBRARY_ALLUSERVIEW

Parameter

required

photolibraryView.mainId The id of the photolibrary

optional

none

return tree

<PHOTOLIBRARY>
  <MAINENTRY>
    <ID>1155931586195</ID>
    <NAME>Ski Tour 2006</NAME>
    <DESCRIPTION>A great week in the Mountains of Salzburg</DESCRIPTION>
    <PREVIEWWIDTH>100</PREVIEWWIDTH>
    <PREVIEWHEIGHT>-1</PREVIEWHEIGHT>
    <FINALWIDTH>600</FINALWIDTH>
    <FINALHEIGHT>-1</FINALHEIGHT>
    <OWNER>
      <ID>2</ID>
      <NAME>admin</NAME>
    </OWNER>
    <PERSONAL>false</PERSONAL>
    <NUMPHOTOS>12</NUMPHOTOS>
    <CHANGE>
      <DATE>08/18/2006 20:06</DATE>
      <LDATE>1155931586247</LDATE>
      <USER>
        <NAME>admin</NAME>
        <ID>2</ID>
        <IP>81.223.9.190</IP>
      </USER>
    </CHANGE>
    <ENTRY>
      <ID>1155932239113</ID>
      <NAME>177_7738.JPG</NAME>
      <EXT>JPG</EXT>
      <THUMBNAIL>/photos/1155931586195/1155932239113tn.JPG</THUMBNAIL>
      <IMAGE>/photos/1155931586195/1155932239113.JPG</IMAGE>
      <ORIGINAL>/photos/1155931586195/1155932239113orig.JPG</ORIGINAL>
      <FILESIZE>956077</FILESIZE>
      <DESCRIPTION />
      <DATE>08/18/2006 20:19</DATE>
      <LDATE>1155932348199</LDATE>
    </ENTRY>
    <ENTRY>
        ...
    </ENTRY>
  </MAINENTRY>
  <ALBUMWEBPATH>/photos/</ALBUMWEBPATH>
</PHOTOLIBRARY>

Example

see HowTo/en/Implementation/Webalbum%20%28Photolibrary%29%20with%20Oberserver%20Design?

getEntry

Get a single picture.

Authorities

  • PHOTOLIBRARY_VIEW
  • PHOTOLIBRARY_USERVIEW
  • PHOTOLIBRARY_ALLUSERVIEW

Parameter

required

photolibraryView.id The id of the photo

optional

none

return tree

  • lastelement: the previous pictures
  • element: the current picture
  • nextelement: the next picture

this function does a roundtrip: when you reach the last picture, nextelement will be the first picture available.

<PHOTOLIBRARY>
  <ID>1155931586195</ID>
  <NAME>Ski Tour 2006</NAME>
  <DESCRIPTION>A great week in the Mountains of Salzburg</DESCRIPTION>
  <PREVIEWWIDTH>100</PREVIEWWIDTH>
  <PREVIEWHEIGHT>-1</PREVIEWHEIGHT>
  <FINALWIDTH>600</FINALWIDTH>
  <FINALHEIGHT>-1</FINALHEIGHT>
  <OWNER>
    <ID>2</ID>
    <NAME>admin</NAME>
  </OWNER>
  <PERSONAL>false</PERSONAL>
  <NUMPHOTOS>12</NUMPHOTOS>
  <CHANGE>
    <DATE>08/18/2006 22:06</DATE>
    <LDATE>1155931586247</LDATE>
    <USER>
      <NAME>admin</NAME>
      <ID>2</ID>
      <IP>81.223.9.190</IP>
    </USER>
  </CHANGE>
  <LASTELEMENT>
    <ID>1155932239114</ID>
    <NAME>177_7739.JPG</NAME>
    <EXT>JPG</EXT>
    <THUMBNAIL>/photos/1155931586195/1155932239114tn.JPG</THUMBNAIL>
    <IMAGE>/photos/1155931586195/1155932239114.JPG</IMAGE>
    <ORIGINAL>/photos/1155931586195/1155932239114orig.JPG</ORIGINAL>
    <FILESIZE>762976</FILESIZE>
    <DESCRIPTION />
    <DATE>08/18/2006 22:19</DATE>
    <LDATE>1155932348909</LDATE>
  </LASTELEMENT>
  <ELEMENT>
    <ID>1155932239115</ID>
    <NAME>177_7750.JPG</NAME>
    <EXT>JPG</EXT>
    <THUMBNAIL>/photos/1155931586195/1155932239115tn.JPG</THUMBNAIL>
    <IMAGE>/photos/1155931586195/1155932239115.JPG</IMAGE>
    <ORIGINAL>/photos/1155931586195/1155932239115orig.JPG</ORIGINAL>
    <FILESIZE>1059384</FILESIZE>
    <DESCRIPTION />
    <DATE>08/18/2006 22:19</DATE>
    <LDATE>1155932349395</LDATE>
  </ELEMENT>
  <NEXTELEMENT>
    <ID>1155932239116</ID>
    <NAME>177_7756_r1.jpg</NAME>
    <EXT>jpg</EXT>
    <THUMBNAIL>/photos/1155931586195/1155932239116tn.jpg</THUMBNAIL>
    <IMAGE>/photos/1155931586195/1155932239116.jpg</IMAGE>
    <ORIGINAL>/photos/1155931586195/1155932239116orig.jpg</ORIGINAL>
    <FILESIZE>1117462</FILESIZE>
    <DESCRIPTION />
    <DATE>08/18/2006 22:19</DATE>
    <LDATE>1155932349917</LDATE>
  </NEXTELEMENT>
  <ALBUMWEBPATH>/photos/</ALBUMWEBPATH>
</PHOTOLIBRARY>

example

see HowTo/en/Implementation/Webalbum%20%28Photolibrary%29%20with%20Oberserver%20Design?

 createMainEntry

creates a new photolibrary.

Authorities

  • PHOTOLIBRARY_MAINCREATE
  • PHOTOLIBRARY_USERMAINCREATE
  • PHOTOLIBRARY_ALLUSERMANAGE

Parameter

required

photolibraryView.createMainEntry Required for function to be executed
photolibraryView.name A short description

optional

photolibraryView.description Additional description
photolibraryView.previewwidth the width of the preview image to create
photolibraryView.previewheight the height of the preview image to create (leave default for correct dimension)
photolibraryView.finalwidth the width of the image to create
photolibraryView.finalheight the height of the image to create (leave default for correct dimension)
photolibraryView.personal Personal photolibrary where the rights will be altered accordingly

If only the width is given the images are resized in aspect ratio - where the given width is the maximum value for either width or height (whatever is bigger).

return tree

Standard return tree

createEntry

adds a new picture to a photolibrary.

Authorities

  • PHOTOLIBRARY_CREATE
  • PHOTOLIBRARY_USERCREATE
  • PHOTOLIBRARY_ALLUSERMANAGE

Parameter

required

photolibraryView.createEntry Required for function to be executed
photolibraryView.mainId The id of the photlibrary the picture(s) should be added to
photolibraryView.file the image (or zip) that should be added (a zip can contain multiple images)

optional

none

return tree

Standard return tree

Example form

<!-- multipart/form-data to be able to transmit files -->
<form method="post" enctype="multipart/form-data">
   <input type="hidden" name="PhotoLibrary_mainId" value="1141748298350"/>
   <input type="file" name="PhotoLibrary_file"/>
   <input type="submit" name="PhotoLibrary_createEntry"/>
</form>

Admin

  • getMainEntries
  • createMainEntry
  • deleteMainEntry
  • getEntries
  • deleteEntries
  • modifyEntries
  • moveEntries