diff options
Diffstat (limited to 'include/photos.php')
-rw-r--r-- | include/photos.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/photos.php b/include/photos.php index 82af4aaeb..65532e6c2 100644 --- a/include/photos.php +++ b/include/photos.php @@ -176,6 +176,7 @@ function photo_upload($channel, $observer, $args) { if(! $r3) $errors = true; } + if($errors) { q("delete from photo where resource_id = '%s' and uid = %d", @@ -188,6 +189,10 @@ function photo_upload($channel, $observer, $args) { return $ret; } + // This will be the width and height of the smallest representation + + $width_x_height = $ph->getWidth() . 'x' . $ph->getHeight(); + $basename = basename($filename); $mid = item_message_id(); @@ -219,9 +224,13 @@ function photo_upload($channel, $observer, $args) { $arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid']; + if ($width_x_height) + $tag = '[zmg=' . $width_x_height. ']'; + else + $tag = '[zmg]'; $arr['body'] = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash . ']' - . '[zmg]' . z_root() . "/photo/{$photo_hash}-{$smallest}.".$ph->getExt() . '[/zmg]' + . $tag . z_root() . "/photo/{$photo_hash}-{$smallest}.".$ph->getExt() . '[/zmg]' . '[/zrl]'; $result = item_store($arr); @@ -426,4 +435,4 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) { $item_id = $result['item_id']; return $item_id; -}
\ No newline at end of file +} |