diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index 494cb1b763..69ba05f14f 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -4,13 +4,14 @@ namespace FireflyIII\Http\Controllers; use Crypt; +use File; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Http\Requests\AttachmentFormRequest; use FireflyIII\Models\Attachment; use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface; -use FireflyIII\Support\CacheProperties; use Input; use Preferences; +use Response; use Session; use URL; use View; @@ -119,54 +120,13 @@ class AttachmentController extends Controller /** * @param Attachment $attachment */ - public function preview(AttachmentHelperInterface $helper, Attachment $attachment) + public function preview(Attachment $attachment) { - if (!function_exists('imagecreatetruecolor')) { - abort(500); - } + $file = public_path('images/image.png'); + $response = Response::make(File::get($file)); + $response->header('Content-Type', 'image/png'); - - $mime = $attachment->mime; - $cache = new CacheProperties; - $cache->addProperty('preview-attachment'); - $cache->addProperty($attachment->id); - if ($cache->has()) { - header('Content-Type: image/png'); - - return $cache->get(); - } - - switch ($mime) { - default: - $img = imagecreatetruecolor(100, 10); - imagesavealpha($img, true); - - $trans_colour = imagecolorallocatealpha($img, 0, 0, 0, 127); - imagefill($img, 0, 0, $trans_colour); - header('Content-Type: image/png'); - imagepng($img); - imagedestroy($img); - $cache->store($img); - exit; - break; - case 'image/jpeg': - case 'image/png': - $img = imagecreatetruecolor(100, 100); - $source = $helper->getAttachmentLocation($attachment); - $decrypt = Crypt::decrypt(file_get_contents($source)); - $original = imagecreatefromstring($decrypt); - $width = imagesx($original); - $height = imagesy($original); - - imagecopyresampled($img, $original, 0, 0, 0, 0, 100, 100, $width, $height); - - header('Content-Type: image/png'); - imagepng($img); - imagedestroy($img); - exit; - - break; - } + return $response; } diff --git a/public/images/image.png b/public/images/image.png new file mode 100755 index 0000000000..fc3c393caa Binary files /dev/null and b/public/images/image.png differ diff --git a/resources/lang/en/firefly.php b/resources/lang/en/firefly.php index 313d140345..24ef1c224b 100644 --- a/resources/lang/en/firefly.php +++ b/resources/lang/en/firefly.php @@ -405,6 +405,14 @@ return [ 'tag_title_nothing' => 'Default tags', 'tag_title_balancingAct' => 'Balancing act tags', 'tag_title_advancePayment' => 'Advance payment tags', + 'tags_introduction' => 'Usually tags are singular words, designed to quickly band items together using things like' . + ' expensive, bill' . + ' or for-party. In Firefly III, tags can have more properties' . + ' such as a date, description and location. This allows you to join transactions together in a more' . + ' meaningful way. For example, you could make a tag called ' . + 'Christmas dinner with friends and add information about the restaurant. Such tags are "singular",' . + ' you would only use them for a single occasion, perhaps with multiple transactions.', + 'tags_group' => 'Tags group transactions together, which makes it possible to store reimbursements (in case you front money for others) and other "balancing acts" where expenses are summed up (the payments on your new TV) or where expenses and deposits are cancelling each other out (buying something with saved money). It\'s all up to you. Using tags the old-fashioned way is of course always possible. ', ]; diff --git a/resources/lang/nl/firefly.php b/resources/lang/nl/firefly.php index eee51f3e65..dbfa8a0bfa 100644 --- a/resources/lang/nl/firefly.php +++ b/resources/lang/nl/firefly.php @@ -420,5 +420,11 @@ return [ 'tag_title_nothing' => 'Standaard tags', 'tag_title_balancingAct' => 'Balancing act tags', 'tag_title_advancePayment' => 'Advance payment tags', + 'tags_introduction' => 'Normaal gesproken zijn tags enkele woorden, gebruikt om gerelateerde zaken snel aan elkaar te plakken. ' . + 'dure-aanschaf, rekening, ' . + 'feestje. In Firefly III hebben tags meer betekenis en kan je er een datum' . + ', beschrijving en locatie aan geven. Daarmee kan je je transacties op een wat zinvollere manier aan elkaar ' . + 'koppelen. Je kan bijvoorbeeld een tag Kerstdiner maken en informatie over' . + ' het restaurant meenemen. Zulke tags zijn enkelvoudig; je gebruikt ze maar bij één gelegenheid.', ]; diff --git a/resources/twig/tags/index.twig b/resources/twig/tags/index.twig index 6290435ff1..8257f8ac5b 100644 --- a/resources/twig/tags/index.twig +++ b/resources/twig/tags/index.twig @@ -17,17 +17,11 @@
- Usually tags are singular words, designed to quickly band items together - using things like expensive, - bill or - for-party. In Firefly III, tags can have more properties - such as a date, description and location. This allows you to join transactions together in a more meaningful - way. For example, you could make a tag called Christmas dinner with friends - and add information about the restaurant. Such tags are "singular", you would only use them for a single occasion, - perhaps with multiple transactions. + {{ 'tags_introduction'|_ }}
+ {{'tags_group'|_ }} Tags group transactions together, which makes it possible to store reimbursements (in case you front money for others) and other "balancing acts" where expenses are summed up (the payments on your new TV) or where expenses and deposits