define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.0.1538' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
-define ( 'DB_UPDATE_VERSION', 1156 );
+define ( 'DB_UPDATE_VERSION', 1157 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
`type` CHAR(128) NOT NULL DEFAULT 'image/jpeg',
`height` smallint(6) NOT NULL,
`width` smallint(6) NOT NULL,
+ `datasize` int(10) unsigned NOT NULL DEFAULT '0',
`data` mediumblob NOT NULL,
`scale` tinyint(3) NOT NULL,
`profile` tinyint(1) NOT NULL DEFAULT '0',
KEY `resource-id` (`resource-id`),
KEY `album` (`album`),
KEY `scale` (`scale`),
+ KEY `datasize` (`datasize`),
KEY `profile` (`profile`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
`album` = '%s',
`height` = %d,
`width` = %d,
+ `datasize` = %d,
`data` = '%s',
`scale` = %d,
`profile` = %d,
dbesc($album),
intval($this->getHeight()),
intval($this->getWidth()),
+ dbesc(strlen($this->imageString())),
dbesc($this->imageString()),
intval($scale),
intval($profile),
}
else {
$r = q("INSERT INTO `photo`
- ( `uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )
- VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, '%s', '%s', '%s', '%s' )",
+ ( `uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `datasize`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )
+ VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, '%s', %d, %d, '%s', '%s', '%s', '%s' )",
intval($uid),
intval($cid),
dbesc($guid),
dbesc($album),
intval($this->getHeight()),
intval($this->getWidth()),
+ dbesc(strlen($this->imageString())),
dbesc($this->imageString()),
intval($scale),
intval($profile),
$default_upload = '<input id="photos-upload-choose" type="file" name="userfile" /> <div class="photos-upload-submit-wrapper" >
<input type="submit" name="submit" value="' . t('Submit') . '" id="photos-upload-submit" /> </div>';
-
- $r = q("select sum(octet_length(data)) as total from photo where uid = %d and scale = 0 and album != 'Contact Photos' ",
- intval($a->data['user']['uid'])
- );
-
-
+ $usage_message = '';
$limit = service_class_fetch($a->data['user']['uid'],'photo_upload_limit');
if($limit !== false) {
+
+ $r = q("select sum(datasize) as total from photo where uid = %d and scale = 0 and album != 'Contact Photos' ",
+ intval($a->data['user']['uid'])
+ );
$usage_message = sprintf( t("You have used %1$.2f Mbytes of %2$.2f Mbytes photo storage."), $r[0]['total'] / 1024000, $limit / 1024000 );
}
- else {
- $usage_message = sprintf( t('You have used %1$.2f Mbytes of photo storage.'), $r[0]['total'] / 1024000 );
- }
$tpl = get_markup_template('photos_upload.tpl');