Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZMedia Class Reference

## Public Member Functions
| __construct ( $id="")
| store ()
| delete ( $id=false)
| get ( $id="")
| existsInCategory (&$category)
| setCategoryDefinition (&$value)
| categoryDefinition ()
| getUnassigned ()
| countUnassigned ()
| id ()
| name ( $html=true)
| caption ( $html=true)
| description ( $html=true)
| fileName ()
| originalFileName ()
| fileExists ( $relative=false)
| filePath ( $relative=false)
| mediaPath ( $relative=false)
| user ()
| setName (&$value)
| setCaption (&$value)
| setDescription (&$value)
| setOriginalFileName (&$value)
| checkMedia (&$file)
| setMedia (&$file)
| setUser (&$user)
| categories ()
| setPhotographer (&$author)
& | photographer ()
| setType (&$type)
| type ()
| removeType ()
| attributeString ()

## Static Public Member Functions
static | getByOriginalFileName ( $id="")
static | isOwner (&$user, &$media)

## Public Attributes
| $ID
| $Name
| $Caption
| $Description
| $FileName
| $OriginalFileName
| $ReadPermission
| $WritePermission
| $UserID
| $PhotographerID
| $NewMedia

## Detailed Description

! eZMediaCatalogue The eZMedia class hadles medias in the media catalogue.

Example code:

// Fetch an uploaded file and store it in the mediacatalogue.
$file = new eZMediaFile();
// userfile is the name of the input in the html form
if ( $file->getUploadedFile( "userfile" ) )
{
$media = new eZMedia();
$media->setName( $Name );
$media->setCaption( $Caption );
$media->setMedia( $file );
$media->store();
}
else
{
print( $file->name() . " not uploaded successfully" );
}
eZMediaFile
Definition: ezmediafile.php:68
eZMedia
Definition: ezmedia.php:65
eZMedia\$Caption
$Caption
Definition: ezmedia.php:732
eZMedia\$Name
$Name
Definition: ezmedia.php:731
$media
if(isset( $AddMedia)) $media
Definition: ezarticle/admin/medialist.php:76
$file
$file
Definition: ezfilemanager/user/filedownload.php:35

See also
  eZMediaCategory eZMediaAttribute eZMediaType

TODO $t in the example just pops out of nowhere, giving us no indication of where it was created or what connection it has with this class

Definition at line 64 of file ezmedia.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZMedia::__construct | ( |  | $id = `""` | ) |

Constructs a new eZMedia object.

Definition at line 69 of file ezmedia.php.

References $id, and $ID.

## Member Function Documentation

## ◆ attributeString()

eZMedia::attributeString | ( |  | ) |

Definition at line 712 of file ezmedia.php.

References $attString, $type, and type().

## ◆ caption()

eZMedia::caption | ( |  | $html = `true` | ) |

Returns the caption of the media.

Definition at line 378 of file ezmedia.php.

References $Caption.

## ◆ categories()

eZMedia::categories | ( |  | ) |

Returns the media's categories.

Definition at line 577 of file ezmedia.php.

References $category, $db, $i, $res, and eZDB\globalDatabase().

## ◆ categoryDefinition()

eZMedia::categoryDefinition | ( |  | ) |

Returns the media's definition category.

Definition at line 296 of file ezmedia.php.

References $category, $db, $res, and eZDB\globalDatabase().

## ◆ checkMedia()

eZMedia::checkMedia | ( | & | $file | ) |

Returns true if the file is a valid media.

Definition at line 514 of file ezmedia.php.

References $file, and $name.

## ◆ countUnassigned()

eZMedia::countUnassigned | ( |  | ) |

Get the total count of all the unassigned medias.

Definition at line 343 of file ezmedia.php.

References $db, $media, and eZDB\globalDatabase().

## ◆ delete()

eZMedia::delete | ( |  | $id = `false` | ) |

Delete the eZMediaVariation object from the database and the filesystem.

Definition at line 152 of file ezmedia.php.

References $db, $id, $ID, file_exists(), filePath(), eZDB\globalDatabase(), and eZPBFile\unlink().

## ◆ description()

eZMedia::description | ( |  | $html = `true` | ) |

Returns the description of the media.

Definition at line 391 of file ezmedia.php.

References $Description.

## ◆ existsInCategory()

eZMedia::existsInCategory | ( | & | $category | ) |

Returns true if the media is assigned to the category given as argument. False if not.

Definition at line 239 of file ezmedia.php.

References $category, $db, $ret, and eZDB\globalDatabase().

## ◆ fileExists()

eZMedia::fileExists | ( |  | $relative = `false` | ) |

Definition at line 417 of file ezmedia.php.

References $FileName, and file_exists().

## ◆ fileName()

eZMedia::fileName | ( |  | ) |

Returns the filename of the media.

Definition at line 404 of file ezmedia.php.

References $FileName.

## ◆ filePath()

eZMedia::filePath | ( |  | $relative = `false` | ) |

Returns the path and filename to the original media.

If $relative is set to true the path is returned relative. Absolute is default.

Definition at line 439 of file ezmedia.php.

References $FileName, file_exists(), and eZPBFile\is_file().

Referenced by delete(), and mediaPath().

## ◆ get()

eZMedia::get | ( |  | $id = `""` | ) |

Fetches the object information from the database.

Definition at line 180 of file ezmedia.php.

References $db, $id, $ret, eZDB\globalDatabase(), and Name.

## ◆ getByOriginalFileName()

static eZMedia::getByOriginalFileName | ( |  | $id = `""` | ) |
| static

Fetches an media from the database if one with the same "original filename" is found.

Definition at line 216 of file ezmedia.php.

References $db, $id, $ret, and eZDB\globalDatabase().

## ◆ getUnassigned()

eZMedia::getUnassigned | ( |  | ) |

Get all the medias that is not assigned to a category.

The medias are returned as an array of eZMedia objects.

Definition at line 322 of file ezmedia.php.

References $db, $media, and eZDB\globalDatabase().

## ◆ id()

eZMedia::id | ( |  | ) |

Returns the id of the media.

Definition at line 359 of file ezmedia.php.

References $ID.

## ◆ isOwner()

static eZMedia::isOwner | ( | & | $user,
|  | & | $media
| ) |  |
| static

\Static Returns true if the given user is the owner of the given object. $user is either a userID or an eZUser. $media is the ID of the media.

Definition at line 604 of file ezmedia.php.

References $db, $res, $user, $userID, and eZDB\globalDatabase().

## ◆ mediaPath()

eZMedia::mediaPath | ( |  | $relative = `false` | ) |

Same as filePath()

Definition at line 460 of file ezmedia.php.

References filePath().

## ◆ name()

eZMedia::name | ( |  | $html = `true` | ) |

Returns the name of the media.

Definition at line 367 of file ezmedia.php.

References $Name, and Name.

## ◆ originalFileName()

eZMedia::originalFileName | ( |  | ) |

Returns the original file name of the media.

Definition at line 412 of file ezmedia.php.

References $OriginalFileName.

## ◆ photographer()

& eZMedia::photographer | ( |  | ) |

Returns the photographer og the media

Definition at line 632 of file ezmedia.php.

## ◆ removeType()

eZMedia::removeType | ( |  | ) |

Removes the links type definition.

Definition at line 701 of file ezmedia.php.

References $db, and eZDB\globalDatabase().

## ◆ setCaption()

eZMedia::setCaption | ( | & | $value | ) |

Sets the media caption.

Definition at line 490 of file ezmedia.php.

## ◆ setCategoryDefinition()

eZMedia::setCategoryDefinition | ( | & | $value | ) |

Set's the medias defined category. This is the main category for the media. Additional categories can be added with eZMediaCategory::addMedia();

Definition at line 262 of file ezmedia.php.

References $categoryID, $db, $query, $res, and eZDB\globalDatabase().

## ◆ setDescription()

eZMedia::setDescription | ( | & | $value | ) |

Sets the media description.

Definition at line 498 of file ezmedia.php.

## ◆ setMedia()

eZMedia::setMedia | ( | & | $file | ) |

Makes a copy of the media and stores the media in the catalogue.

If the media is not of the type .jpg or .gif the media is converted to .jpg.

Definition at line 529 of file ezmedia.php.

References $file, $name, $suffix, and eZMediaFile\information().

## ◆ setName()

eZMedia::setName | ( | & | $value | ) |

Sets the media name.

Definition at line 482 of file ezmedia.php.

References Name.

## ◆ setOriginalFileName()

eZMedia::setOriginalFileName | ( | & | $value | ) |

Sets the original medianame.

Definition at line 506 of file ezmedia.php.

## ◆ setPhotographer()

eZMedia::setPhotographer | ( | & | $author | ) |

Sets the photographer of the media

Definition at line 621 of file ezmedia.php.

References $author.

## ◆ setType()

eZMedia::setType | ( | & | $type | ) |

Sets the links type.

Definition at line 640 of file ezmedia.php.

References $db, $query, $res, $type, and eZDB\globalDatabase().

## ◆ setUser()

eZMedia::setUser | ( | & | $user | ) |

Sets the user of the eZMedia object.

Definition at line 564 of file ezmedia.php.

References $user, and $userID.

## ◆ store()

eZMedia::store | ( |  | ) |

Stores a eZMedia object to the database.

Definition at line 83 of file ezmedia.php.

References $db, $name, $res, eZDB\globalDatabase(), and Name.

## ◆ type()

eZMedia::type | ( |  | ) |

Returns the link's type.

Definition at line 681 of file ezmedia.php.

References $db, $res, $type, and eZDB\globalDatabase().

Referenced by attributeString().

## ◆ user()

eZMedia::user | ( |  | ) |

Returns a eZUser object.

Definition at line 468 of file ezmedia.php.

References $ret.

## Member Data Documentation

## ◆ $Caption

eZMedia::$Caption

Definition at line 732 of file ezmedia.php.

Referenced by caption().

## ◆ $Description

eZMedia::$Description

Definition at line 733 of file ezmedia.php.

Referenced by description().

## ◆ $FileName

eZMedia::$FileName

Definition at line 734 of file ezmedia.php.

Referenced by fileExists(), fileName(), and filePath().

## ◆ $ID

eZMedia::$ID

Definition at line 730 of file ezmedia.php.

Referenced by __construct(), delete(), and id().

## ◆ $Name

eZMedia::$Name

Definition at line 731 of file ezmedia.php.

Referenced by name().

## ◆ $NewMedia

eZMedia::$NewMedia

Definition at line 740 of file ezmedia.php.

## ◆ $OriginalFileName

eZMedia::$OriginalFileName

Definition at line 735 of file ezmedia.php.

Referenced by originalFileName().

## ◆ $PhotographerID

eZMedia::$PhotographerID

Definition at line 739 of file ezmedia.php.

## ◆ $ReadPermission

eZMedia::$ReadPermission

Definition at line 736 of file ezmedia.php.

## ◆ $UserID

eZMedia::$UserID

Definition at line 738 of file ezmedia.php.

## ◆ $WritePermission

eZMedia::$WritePermission

Definition at line 737 of file ezmedia.php.

The documentation for this class was generated from the following file:

- ezmedia.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.