Author SHA1 Message Date
Anthony Le Mansec 4620297fcc cleanup 2010-10-04 16:16:34 +02:00
Anthony Le Mansec 2db4376b2a doc: markdown and unordered lists 2010-10-04 16:10:46 +02:00
Anthony Le Mansec 0603b23f0d doc: switched to markdown markup 2010-10-04 15:58:48 +02:00
Anthony Le Mansec 5e3306c70a cleanup: moved old code to temporary subdirectory 2010-09-25 15:23:25 +02:00
Anthony Le Mansec 9273d31f48 testing current codebase. 2010-09-24 20:39:28 +02:00
Anthony Le Mansec 9c02139958 minor : getImageDatas() implementation 2010-09-24 20:39:06 +02:00
Anthony Le Mansec 5d59cc4d1a doc : doxygen tag update on renderImage returned value 2010-09-24 20:38:17 +02:00
Anthony Le Mansec 0a4309134e minor : WebAsset_Fetcher initial implementation 2010-09-24 20:37:30 +02:00
Anthony Le Mansec 9eb76546fd minor : WebAsset_Converter skeleton 2010-09-24 20:37:00 +02:00
Anthony Le Mansec a949a7fee2 new WaException_Fetch class 2010-09-24 20:36:11 +02:00
Anthony Le Mansec 1c3a70b3fc cleanup : WebAsset is now passed as arguments, instead of just asset UUID. 2010-09-24 20:35:16 +02:00
Anthony Le Mansec c6264caa5a fix : typo 2010-09-24 20:33:07 +02:00
Anthony Le Mansec 3ced30eb6e fix : getkey() empty string returned on failure 2010-09-24 20:32:47 +02:00
Anthony Le Mansec 7ce45d9bd5 default configuration file is now defined. 2010-09-24 20:31:25 +02:00
Anthony Le Mansec 27adf76e4b minor : WebAssetViewer load() method now throws custom exceptions on failure 2010-09-24 19:01:07 +02:00
Anthony Le Mansec ad0dd9cbca IAssetCache interface and WebAsset_Cache class skeletons 2010-09-24 18:31:58 +02:00
Anthony Le Mansec 4e18ab29f7 WebAsset_Viewer now implements IAssetViewer 2010-09-24 18:01:22 +02:00
Anthony Le Mansec 54e7ac0ce1 doc : a few more doxygen tags 2010-09-24 17:34:37 +02:00
Anthony Le Mansec 074a9c845c cleanup : moving webAssets configuration to plain ini file. 2010-09-24 17:13:58 +02:00
Anthony Le Mansec 1cb97cfdf7 minor: rough import of our Config_Ini class 2010-09-24 12:17:44 +02:00
Anthony Le Mansec aa7b54b42b minor: first interfaces/classes / directory structure skeletons. 2010-09-24 11:59:30 +02:00
Anthony Le Mansec 77936e26a0 doc : oo vocabulary update for upcoming release. 2010-09-24 08:04:03 +02:00
Anthony Le Mansec 1ce8d1a097 doc : removed duplicate php reference 2010-09-21 13:36:21 +02:00
Anthony Le Mansec 0d1fd3d6b8 minor : moved source files to src/ 2010-09-21 13:33:24 +02:00
Anthony Le Mansec f130fb3e16 doc: (minor) typo 2010-09-04 15:21:59 +02:00
Anthony Le Mansec 1264de04dc doc: (minor) typo. 2010-09-04 01:53:32 +02:00
36 changed files with 818 additions and 72 deletions
-1
View File
@@ -1,7 +1,6 @@
Requirements :
--------------
- Running OpenSimulator Grid
- Php-enabled webserver
- Php5 > 5.1.3
- ImageMagick > 6.2.4 (WITH jp2 delegate)
- imagick PECL > 2.2.0 (http://pecl.php.net/package/imagick or "pecl install imagick")
-25
View File
@@ -1,25 +0,0 @@
About WebAssets for OpenSimulator
-===============================-
This small set of php functions provide easy access to OpenSimulator
assets, adding another level of caching, thus limiting load on given
asset server.
Typical usage includes web publication of avatar's profile pictures, library and user
stored textures, region maptiles, user and regions/lands snapshots.
It was updated and tested on September 2010, with following software :
WebServer :
- Apache 2.2.16
- Php 5.2.14
- imagick 2.3.0 PECL package
- ImageMagick 6.6.2.5 with jpeg2k delegate
running on linux 2.6.34, gentoo 64bits
OpenSimulator AssetServer :
- OpenSimulator 0.6.9 (grid mode) both from a local grid and current osgrid.org GRID.
Installation
-==========-
See included file INSTALL
+32
View File
@@ -0,0 +1,32 @@
WebAssets for OpenSimulator
===========================
This small set of php classes provides easy access to OpenSimulator
assets, adding another level of caching, thus limiting load on given
asset server.
Typical usage includes web publication of avatar's profile pictures, library and user
stored textures, user snapshots...
It was updated and tested on September 2010, with following software :
WebServer :
* Apache 2.2.16
* Php 5.2.14
* imagick 2.3.0 PECL package
* ImageMagick 6.6.2.5 with jpeg2k delegate
running on linux 2.6.34, gentoo 64bits
OpenSimulator AssetServer :
* OpenSimulator 0.6.9 (grid mode) both from a local grid and current osgrid.org GRID.
Installation
------------
See included INSTALL file.
+5 -2
View File
@@ -1,5 +1,8 @@
- Basic ImageMagick exceptions/error handling
[ ] use spl_autoload_register() to register our autoloader.
- Make a clean oo interface to this.
[ ] write a CachedConfig engine, extending our ConfigEngine class
[ ] move remaining code from non-object functions to proper classes.
[ ] Basic ImageMagick exceptions/error handling
-44
View File
@@ -1,44 +0,0 @@
<?php
/*
* This file is part of WebAssets for OpenSimulator.
*
* WebAssets for OpenSimulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* WebAssets for OpenSimulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WebAssets for OpenSimulator. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file config.php
* @brief Misc configuration variables.
*
* @author Anthony Le Mansec <a.lm@free.fr>
*/
define('ASSET_SERVER', 'http://assets.osgrid.org:8003/assets/'); // (OpenSim.ini: asset_server_url . "/assets/")
define('ASSET_SERVER_TIMEOUT', 8); // timeout in seconds, to wait while requesting an asset (default to 8)
define('ASSET_DO_RESIZE', true); // shall we resize picture to width=ASSET_RESIZE_FIXED_WIDTH ?
define('ASSET_RESIZE_FIXED_WIDTH', 150); // width in pixels
/* Will show following image if no asset was requested (malformed query) : */
define('ASSET_ID_NOTFOUND', 'cb2052ae-d161-43e9-b11b-c834217823cd');
/* will show following picture for Zero UUID (not found / malformed assets) : */
define('IMAGE_ID_ZERO', '/var/www/mysite.com/webassets/pic/uuid_zero'); // no extension here
define('IMAGE_DEFAULT_FORMAT', 'JPEG');
/* Re-use locally cached pictures (jp2k & converted) for 1 day before re-requesting it : */
define('CACHE_MAX_AGE', 86400); // 1 day
/* where to store cached pictures ? (user running your webserver needs write-permissions there : */
define('JP2_CACHE_DIR', '/var/www/datas/webassets/cache/jp2/');
define('PIC_CACHE_DIR', '/var/www/datas/webassets/cache/pic/');
?>
View File
+56
View File
@@ -0,0 +1,56 @@
<?php
/*
* This file is part of WebAssets for OpenSimulator.
*
* WebAssets for OpenSimulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* WebAssets for OpenSimulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WebAssets for OpenSimulator. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file bootstrap.php
* @brief simple autoloader initialization.
* @details our autoloader lookups interfaces under 'interfaces/Ifoo.interface.php' (IFoo interface)
* and classes under 'classes/FirstWord/SecondWord.class.php' ('FirstWord_SecondWord' class)
*/
define('SEP', DIRECTORY_SEPARATOR);
define('ROOT', dirname(__FILE__));
define('CLASSES', ROOT . SEP . 'classes' . SEP);
define('INTERFACES', ROOT . SEP . 'interfaces' . SEP);
define('CONFIG_INI', ROOT . SEP . 'config' . SEP . 'default.ini');
/**
* @brief simple autoloader, for our classes and interfaces.
* @details lookups interfaces under 'interfaces/Ifoo.interface.php' (IFoo interface)
* and classes under 'classes/FirstWord/SecondWord.class.php' ('FirstWord_SecondWord' class)
* @throws RuntimeException when requested class/interface is not found.
*/
function __autoload($className) {
// looking for classes :
$classFile = CLASSES . str_replace('_', SEP, $className.'.class.php');
if (file_exists($classFile)) {
require_once($classFile);
return;
}
// looking for interfaces :
$interfaceFile = INTERFACES . str_replace('_', SEP, $className.'.interface.php');
if (file_exists($interfaceFile)) {
require_once($interfaceFile);
return;
}
throw new RuntimeException('unable to load '.$class_name);
}
?>
+50
View File
@@ -0,0 +1,50 @@
<?
/*
* This file is part of WebAssets for OpenSimulator.
*
* WebAssets for OpenSimulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* WebAssets for OpenSimulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WebAssets for OpenSimulator. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file Engine.class.php
* @brief Config Engine abstract class declaration
*/
/** @addtogroup Config */
/** @{ */
/**
* @brief Config Engine class abstract
* @details Our Config engine class signature
* @abstract
*/
abstract class Config_Engine implements IConfigEngine {
/** @brief pointer to current instance */
protected static $_instance;
/** @brief singleton mechanism */
abstract public static function instance();
/** @brief per-extending class custom initialization */
abstract protected function init();
function __construct() {
$this->init();
}
}
/** @} */
?>
+113
View File
@@ -0,0 +1,113 @@
<?php
/*
* This file is part of WebAssets for OpenSimulator.
*
* WebAssets for OpenSimulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* WebAssets for OpenSimulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WebAssets for OpenSimulator. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file Ini.class.php
* @brief Config_Engine_Ini class implementation
*/
/** @addtogroup Config */
/** @{ */
/**
* @brief INI file configuration class
* @details Simple ini-file accessor
*/
class Config_Engine_Ini extends Config_Engine {
/** @brief currently loaded ini file */
private $_filename;
/** @brief currently loaded config array */
private $_config;
function __destruct() {
}
protected function init() {
$this->_config = array();
$this->_filename = "";
if (defined('CONFIG_INI'))
$this->load(CONFIG_INI);
}
public static function instance() {
if (!self::$_instance)
self::$_instance = new Config_Engine_Ini();
return (self::$_instance);
}
public function load($cfg_identifier) {
if (!is_file($cfg_identifier))
throw new RuntimeException('invalid config identifier');
$process_sections = true;
$this->_config = parse_ini_file($cfg_identifier, $process_sections);
$this->_filename = $cfg_identifier;
}
/**
* @todo implement this
*/
public function save() {
}
/**
* @brief returns given key within given section
* @param group - ini section where to load given key
* @param key - key to retrieve
* @return mixed - given key value within given section
*/
public function getkey($group, $key) {
if (!array_key_exists($group, $this->_config))
return ("");
if (!array_key_exists($key, $this->_config[$group]))
return ("");
return ($this->_config[$group][$key]);
}
/**
* @todo implement this
*/
public function setkey($group, $key, $val) {
}
/**
* @brief returns currently loaded config as an array
* @return array - associative array representing loaded ini file
*/
public function get() {
return ($this->_config);
}
/**
* @brief get given ini section, as an array
* @param $group string - ini section to load
* @return array - loaded section as an associative array
*/
public function getGroup($group) {
if (!array_key_exists($group, $this->_config))
return (array());
return ($this->_config[$group]);
}
}
/** @} */
?>
+80
View File
@@ -0,0 +1,80 @@
<?php
/*
* This file is part of WebAssets for OpenSimulator.
*
* WebAssets for OpenSimulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* WebAssets for OpenSimulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WebAssets for OpenSimulator. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file Xml.class.php
* @brief Config_Engine_Xml class implementation
*/
/** @addtogroup Config */
/** @{ */
/**
* @brief XML config loader
* @details Simple xml-config accessor
*/
class Config_Engine_Xml extends Config_Engine {
function __destruct() {
}
protected function init() {
}
public static function instance() {
if (!self::$_instance)
self::$_instance = new Config_Engine_Xml();
return (self::$_instance);
}
/** @todo implement this */
public function load($cfg_identifier) {
}
/** @todo implement this */
public function save() {
}
/** @todo implement this */
public function getkey($group, $key) {
}
/** @todo implement this */
public function setkey($group, $key, $val) {
}
/** @todo implement this */
public function get() {
}
/** @todo implement this */
public function getGroup($group) {
}
}
/** @} */
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
class WaException_Cache extends Exception {
}
?>
@@ -0,0 +1,7 @@
<?php
class WaException_Convert extends Exception {
}
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
class WaException_Fetch extends Exception {
}
?>
@@ -0,0 +1,7 @@
<?php
class WaException_Timeout extends Exception {
}
?>
+52
View File
@@ -0,0 +1,52 @@
<?php
/*
* This file is part of WebAssets for OpenSimulator.
*
* WebAssets for OpenSimulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* WebAssets for OpenSimulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WebAssets for OpenSimulator. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file WebAsset.class.php
* @brief WebAsset class implementation.
*/
/**
* @brief An opensim asset, suitable for opensimWebAsset usage.
* @details Represents an opensim asset suitable for opensimWebAssets usage.
*/
class WebAsset implements IOpensimAsset {
protected $uuid; /**< asset's UUID, internally assigned by Opensimulator */
function __construct($id) {
$this->uuid = $id;
}
/**
* @brief sets current WebAsset's UUID
* @param id (string) opensim UUID for asset. ex: "00000000-0000-0000-0000-000000000000"
* @return void
*/
public function setUUID($id) {
$this->uuid = $id;
}
/**
* @brief returns UUID associated to current asset.
* @return (string) asset's UUID.
*/
public function getUUID() {
return ($this->uuid);
}
}
?>
+40
View File
@@ -0,0 +1,40 @@
<?php
class WebAsset_Cache implements IAssetCache {
private static $_instance;
public static function instance() {
if (!self::$_instance) {
self::$_instance = new WebAsset_Cache();
}
return (self::$_instance);
}
public function isFormatCached($asset, $format) {
}
public function isCached($asset) {
return (false);
}
public function retrieveFormat($asset, $format) {
}
public function retrieve($asset) {
// if (read fails) throw new WaException_Cache("fopen / fread error msg");
}
public function storeFormat($asset, $format, $datas) {
}
public function store($asset, $datas) {
}
}
?>
+20
View File
@@ -0,0 +1,20 @@
<?php
class WebAsset_Converter {
private static $_instance;
public static function instance() {
if (!self::$_instance) {
self::$_instance = new WebAsset_Converter();
}
return (self::$_instance);
}
/** @todo implement this */
public function convert($asset, $toFormat) {
}
}
?>
+42
View File
@@ -0,0 +1,42 @@
<?php
class WebAsset_Fetcher {
private static $_instance;
public static function instance() {
if (!self::$_instance) {
self::$_instance = new WebAsset_Fetcher();
}
return (self::$_instance);
}
public function fetch($asset) {
$config = Config_Engine_Ini::instance();
$asset_server = "http://" . $config->getkey('assetServer', 'host') . ':'
. $config->getkey('assetServer', 'port') . "/assets/";
$asset_url = $asset_server . $asset->getUUID();
$h = @fopen($asset_url, "rb");
if (!$h) {
throw new WaException_Fetch("unable to connect to asset server [".$asset_url."]");
}
stream_set_timeout($h, $config->getkey('assetServer', 'timeout'));
$asset_xmldatas = stream_get_contents($h);
fclose($h);
try {
$xml = new SimpleXMLElement($asset_xmldatas);
} catch (Exception $e) {
throw new WaException_Fetch("unable to read asset xml [".$asset->getUUID()."]");
}
$datas = base64_decode($xml->Data);
return ($datas);
}
}
?>
+88
View File
@@ -0,0 +1,88 @@
<?php
/*
* This file is part of WebAssets for OpenSimulator.
*
* WebAssets for OpenSimulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* WebAssets for OpenSimulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WebAssets for OpenSimulator. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @todo implement this :p
*/
class WebAsset_Viewer implements IAssetViewer {
private static $_instance; /**< pointer to current instance */
private $_asset;
/**
* @brief simple singleton mechanism
* @return (WebAsset_Viewer) newly_created or current instance
*/
public static function instance() {
if (!self::$_instance) {
self::$_instance = new WebAsset_Viewer();
}
return (self::$_instance);
}
public function load($asset) {
// if (fetch timeout) throw new WaException_Timeout("asset fetch timed out");
// if (connect failed) throw new WaException_Fetch("unable to connect...");
// if (cache or read failed) throw new WaException_Cache("write permission denied");
// if (conversion failed) throw new WaException_Convert("Imagick error msg..")
$this->_asset = $asset;
$cache = WebAsset_Cache::instance();
if ($cache->isCached($asset)) {
// available in cache, no need to fetch asset
// FIXME : if cache expires between load() and renderImage() | getImageDatas(), read fails
return;
}
$fetcher = WebAsset_Fetcher::instance();
$cache->store($asset, $fetcher->fetch($asset));
}
public function renderImage($toFormat) {
}
public function getImageDatas($toFormat) {
$cache = WebAsset_Cache::instance();
$is_cached = $cache->isFormatCached($this->_asset, $toFormat);
if ($is_cached) {
return ($cache->retrieveFormat($this->_asset, $toFormat));
}
// convert to requested format:
$converter = WebAsset_Converter::instance();
$datas = $converter->convert($this->_asset, $toFormat);
// store converted asset to cache:
$cache->storeFormat($this->_asset, $toFormat, $datas);
return ($datas);
}
public function renderSound() {
}
public function renderAnimation() {
}
}
?>
View File
+36
View File
@@ -0,0 +1,36 @@
;
; config/default.ini :
; opensimWebAssets default configuration file.
;
[webAssets]
debug = false
log_enable = false
log_file = "/tmp/webassets.log"
[assetServer]
; host=myhost port=4242 will use http://myhost:4242/assets/
host = "assets.osgrid.org"
port = 8003
timeout = 10
[localCache]
; jp2_dir : local cache directory for fetched assets (jpeg2k)
jp2_dir = "/var/www/datas/webassets/tmp/cache/jp2/"
; pic_dir : converted pictures local cache dir
pic_dir = "/var/www/datas/webassets/tmp/cache/pic/"
; max_age : re-use locally cached files (jp2 & converted) for this amount of seconds:
max_age = 86400
[images]
default_format = "JPEG"
; resize_enable : wether to enable image resizing or not (true/false)
resize_enable = true
; resize_width : resized image width in pixels
resize_width = 150
; notfound_uuid_fallback : fallback on this asset on malformed query / notfound
notfound_uuid_fallback = "cb2052ae-d161-43e9-b11b-c834217823cd"
; notfound_image_fallback : display this picture (extension automatically added) on error/notfound:
notfound_image_fallback = "/var/www/mysite.com/webassets/htdocs/pic/uuid_zero"

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

+53
View File
@@ -0,0 +1,53 @@
<?php
interface IAssetCache {
/**
* @brief checks wether given asset is locally cached in given format.
* @details an asset fetched and converted to given format is
* locally cached for configured max_age seconds (see config/default.ini).
* @param asset (WebAsset object) asset
* @param format (string) previously converted format to lookup in cache.
* @return (boolean) true if asset is available in cache, false otherwise.
*/
function isFormatCached($asset, $format);
/**
* @brief checks wether given asset is locally cached in raw format.
* @details assets are locally cached in their opensim-format for max_age seconds
* @return (boolean) true if datas are locally cached (and not expired).
*/
function isCached($asset);
/**
* @brief reads and returns given asset from local cache, in given format.
* @param $asset (WebAsset) asset.
* @param $format (string) previously converted format to lookup in cache.
* @return (binary) raw asset datas (in given format).
*/
function retrieveFormat($asset, $format);
/**
* @brief reads and returns raw asset datas from local cache.
* @param asset (WebAsset) asset to read from local cache.
* @return (binary) raw asset datas, in opensim native format.
*/
function retrieve($asset);
/**
* @brief writes given asset datas, in given format, to local cache.
* @param asset (WebAsset) asset to save to cache.
* @param format (string) format of datas to cache (eg: "JPEG")
* @param datas (binary) asset binary datas, in given format.
*/
function storeFormat($asset, $format, $datas);
/**
* @brief writes given asset datas, in opensim native format, to local cache.
* @param asset (WebAsset) asset to save to cache.
* @param datas (binary) asset binary datas, in opensim native format.
*/
function store($asset, $datas);
}
?>
+37
View File
@@ -0,0 +1,37 @@
<?php
interface IAssetViewer {
/**
* @brief loads given asset from configured asset server.
* @param assetUUID (string) asset's UUID
* @return void
* @throw WaException_Timeout on fetch timeout
* @throw WaException_Cache on cache read/write failure
* @throw WaException_Convert on conversion failure
*/
function load($assetUUID);
/**
* @brief renders currently loaded image asset to given format.
* @param toFormat (string) format identifier to convert image to (eg: "JPEG")
* @return (void) sets http content-type header and outputs raw image datas.
*/
function renderImage($toFormat);
/**
* @brief gets image asset raw datas, after conversion to toFormat.
* @param toFormat (string) format identifier to convert image to (eg: "JPEG")
* @return (binary) raw image datas.
*/
function getImageDatas($toFormat);
/** @todo find sound assets, experiment and implement this. */
function renderSound();
/** @todo find animation assets, experiment and find a way to render anims */
function renderAnimation();
}
?>
@@ -0,0 +1,42 @@
<?php
/*
* This file is part of WebAssets for OpenSimulator.
*
* WebAssets for OpenSimulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* WebAssets for OpenSimulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WebAssets for OpenSimulator. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @brief interface describing a ConfigEngine
*/
interface IConfigEngine {
/** @brief loads given config */
function load($cfg_identifier);
/** @brief saves current configuration */
function save();
/** @brief retrieve given key, within given group */
function getkey($group, $key);
/** @brief assign given val to given group/key */
function setkey($group, $group, $val);
/** @brief returns current config as a php array */
function get();
/** @brief returns given config group as an array */
function getGroup($group);
}
?>
@@ -0,0 +1,29 @@
<?php
/*
* This file is part of WebAssets for OpenSimulator.
*
* WebAssets for OpenSimulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* WebAssets for OpenSimulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WebAssets for OpenSimulator. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @brief interface representing an opensimulator asser
* @todo add more asset properties/accessors
*/
interface IOpensimAsset {
function setUUID($uuid);
function getUUID();
}
?>
+15
View File
@@ -0,0 +1,15 @@
<?php
/**
* @file test.php
* @brief bare test script.
* @details local testing of our classes.
*/
require_once('bootstrap.php');
$viewer = WebAsset_Viewer::instance();
//$viewer->load(new WebAsset("cb2052ae-d161-43e9-b11b-c834217823cd"));
$viewer->load(new WebAsset("00000000-0000-0000-0000-000000000000"));
$rawImage = $viewer->getImageDatas("JPEG");
?>
View File
View File
View File
View File
View File