18 require_once SQ_INCLUDE_PATH.
'/asset_management.inc';
49 'description' =>
'The text to be used in the Alt attribute of the IMG tag',
51 'is_contextable' => TRUE,
57 'description' =>
'Some text to be associated with the image and can be accessed and printed out separately if required',
59 'is_contextable' => TRUE,
65 'description' =>
'Width of the image (generated from the image file)',
72 'description' =>
'Height of the image (generated from the image file)',
79 'description' =>
'Size (in bytes) of the image (generated from the image file)',
84 'type' =>
'serialise',
88 'variety_count' => Array(
94 'embedded_data' => Array(
96 'type' =>
'serialise',
98 'description' =>
'Embedded Metadata placed by Photoshop',
117 if (!parent::_upgrade($current_version))
return FALSE;
119 $asset_name = strtoupper($this->_pm->getTypeInfo($this->getAssetType(),
'name'));
121 if (version_compare($current_version,
'0.2',
'<')) {
124 pre_echo(
'STARTING '.$asset_name.
' UPGRADE - FROM VERSION 0.1');
125 $images = $GLOBALS[
'SQ_SYSTEM']->am->getTypeAssetids($this->
getAssetType(), FALSE, TRUE);
126 foreach ($images as $assetid => $type_code) {
127 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid, $type_code);
128 if (is_null($asset))
continue;
130 if (!$asset->setAttrValue(
'alt', $asset->name) || !$asset->setAttrValue(
'title', $asset->name)) {
131 echo
'Asset #', $asset->id,
' (', $asset->name,
') Unable to set alt and/or title',
"\n";
135 $info = $asset->getExistingFile();
137 if (!$asset->setAttrValue(
'width', $info[
'width']) || !$asset->setAttrValue(
'height', $info[
'height']) || !$asset->setAttrValue(
'size', $info[
'size'])) {
138 echo
'Asset #', $asset->id,
' (', $asset->name,
') Unable to set width, height and/or size',
"\n";
143 if (!$asset->saveAttributes()) {
144 echo
'Asset #', $asset->id,
' (', $asset->name,
') Unable to save attributes',
"\n";
147 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($asset);
151 pre_echo($asset_name.
' UPGRADE COMPLETE - FROM VERSION 0.1');