diff --git a/boot.php b/boot.php
index 8c3cf7b273..1809df966c 100644
--- a/boot.php
+++ b/boot.php
@@ -14,7 +14,7 @@ require_once('include/features.php');
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', "
\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
diff --git a/database.sql b/database.sql
index 0f82616f7b..369637fe60 100644
--- a/database.sql
+++ b/database.sql
@@ -777,6 +777,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
`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',
@@ -789,6 +790,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
KEY `resource-id` (`resource-id`),
KEY `album` (`album`),
KEY `scale` (`scale`),
+ KEY `datasize` (`datasize`),
KEY `profile` (`profile`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
diff --git a/include/Photo.php b/include/Photo.php
index 8fd581977d..69b08f6291 100644
--- a/include/Photo.php
+++ b/include/Photo.php
@@ -584,6 +584,7 @@ class Photo {
`album` = '%s',
`height` = %d,
`width` = %d,
+ `datasize` = %d,
`data` = '%s',
`scale` = %d,
`profile` = %d,
@@ -604,6 +605,7 @@ class Photo {
dbesc($album),
intval($this->getHeight()),
intval($this->getWidth()),
+ dbesc(strlen($this->imageString())),
dbesc($this->imageString()),
intval($scale),
intval($profile),
@@ -616,8 +618,8 @@ class Photo {
}
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),
@@ -629,6 +631,7 @@ class Photo {
dbesc($album),
intval($this->getHeight()),
intval($this->getWidth()),
+ dbesc(strlen($this->imageString())),
dbesc($this->imageString()),
intval($scale),
intval($profile),
diff --git a/mod/photos.php b/mod/photos.php
index 08dc0e0fc5..efccb0e10a 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -1027,19 +1027,15 @@ function photos_content(&$a) {
$default_upload = '