aboutsummaryrefslogtreecommitdiffstats
path: root/include/photos.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-06-23 22:46:39 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-06-23 22:46:39 -0700
commit86588bdd6cf765d2f334168da5e056923c440aba (patch)
tree313cde1a1d577856cdc5a8a90479c7aa968ca85d /include/photos.php
parent1a0655f34ea9979c7a08d21344d3e0eb9eb3246d (diff)
downloadvolse-hubzilla-86588bdd6cf765d2f334168da5e056923c440aba.tar.gz
volse-hubzilla-86588bdd6cf765d2f334168da5e056923c440aba.tar.bz2
volse-hubzilla-86588bdd6cf765d2f334168da5e056923c440aba.zip
more work on photos, including os_storage for the size '0' photo and numbering duplicate filenames
Diffstat (limited to 'include/photos.php')
-rw-r--r--include/photos.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/include/photos.php b/include/photos.php
index bc6d1a758..867571f8f 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -55,7 +55,18 @@ function photo_upload($channel, $observer, $args) {
$str_group_deny = perms2str(((is_array($args['group_deny'])) ? $args['group_deny'] : explode(',',$args['group_deny'])));
$str_contact_deny = perms2str(((is_array($args['contact_deny'])) ? $args['contact_deny'] : explode(',',$args['contact_deny'])));
- if ($args['data']) {
+ $os_storage = 0;
+
+ if($args['os_path'] && $args['getimagesize']) {
+ $imagedata = @file_get_contents($args['os_path']);
+ $filename = $args['filename'];
+ $filesize = strlen($imagedata);
+ // this is going to be deleted if it exists
+ $src = '/tmp/deletemenow';
+ $type = $args['getimagesize']['mime'];
+ $os_storage = 1;
+ }
+ elseif ($args['data']) {
// allow an import from a binary string representing the image.
// This bypasses the upload step and max size limit checking
@@ -158,7 +169,8 @@ function photo_upload($channel, $observer, $args) {
$p = array('aid' => $account_id, 'uid' => $channel_id, 'xchan' => $visitor, 'resource_id' => $photo_hash,
'filename' => $filename, 'album' => $album, 'scale' => 0, 'photo_usage' => PHOTO_NORMAL,
'allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
- 'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny
+ 'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny,
+ 'os_storage' => $os_storage, 'os_path' => $args['os_path']
);
if($args['created'])
$p['created'] = $args['created'];
@@ -173,6 +185,10 @@ function photo_upload($channel, $observer, $args) {
if(! $r1)
$errors = true;
+
+ unset($p['os_storage']);
+ unset($p['os_path']);
+
if(($width > 640 || $height > 640) && (! $errors)) {
$ph->scaleImage(640);
$p['scale'] = 1;