aboutsummaryrefslogtreecommitdiffstats
path: root/mod/photos.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-10-16 04:21:40 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-10-16 04:21:40 -0700
commitc07f694a074e034ab78b88c9b9a73776090a929b (patch)
tree983ef631fae3238c2b8a225d58349fcc84ef1822 /mod/photos.php
parenta756c0b18228982743049f7691229ba55e83983f (diff)
downloadvolse-hubzilla-c07f694a074e034ab78b88c9b9a73776090a929b.tar.gz
volse-hubzilla-c07f694a074e034ab78b88c9b9a73776090a929b.tar.bz2
volse-hubzilla-c07f694a074e034ab78b88c9b9a73776090a929b.zip
another try at issue #89 - rotating photos
Diffstat (limited to 'mod/photos.php')
-rw-r--r--mod/photos.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/mod/photos.php b/mod/photos.php
index e484880e3..b4ca19749 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -244,9 +244,25 @@ function photos_post(&$a) {
$width = $ph->getWidth();
$height = $ph->getHeight();
+
+ if(intval($r[0]['os_storage'])) {
+ @file_put_contents($r[0]['data'],$ph->imageString());
+ $data = $r[0]['data'];
+ $fsize = @filesize($r[0]['data']);
+ q("update attach set filesize = %d where hash = '%s' and uid = %d limit 1",
+ intval($fsize),
+ dbesc($resource_id),
+ intval($page_owner_uid)
+ );
+ }
+ else {
+ $data = $ph->imageString();
+ $fsize = strlen($data);
+ }
- $x = q("update photo set data = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and scale = 0",
- dbescbin($ph->imageString()),
+ $x = q("update photo set data = '%s', `size` = %d, height = %d, width = %d where `resource_id` = '%s' and uid = %d and scale = 0",
+ dbescbin($data),
+ intval($fsize),
intval($height),
intval($width),
dbesc($resource_id),