Create a custom URL for a paperclip attachment - paperclip

I'm using Rails 5.1 and Paperclip to upload attachments.
I've created an Attachment model which has an attached file called document. Attachment belongs to the model Entry.
I wanted the default url for the attachments to be on the format /admin/entries/:entry_id/attachments/attachment_name and the storage path to be of the format /public/entries/:entry_id/attachment_name.
I looked into the Paperclip wiki but I couldn't find a way to get :entry_id in the url.
Would anyone know how to do this?
Thanks :)

I assume that you should specify that in model where you attached paperclip. Look at this post. It looks same as you want to do . paperclip custom :path and :url

Related

How to insert image into strapi article?

I'm beginner of strapi, nodejs headless cms framework.
I've followed quick start guide of official document. I've created gatsby-blog and it works.
After setup, I've created new article with uploaded image, in the middle of article. (Not the image field in the Slug section) In the strapi admin page, I can find my new image in the media library list.
But when I open my strapi client in browser, the image is not shown. The source of image seems to the file path of backend server. I can find the image file on the backend/public/uploads folder. But it returns 404 error.
So, What am I missing of strapi setting? I've searched a lot but I can't find similar issue.
Make sure that the field is public in your Strapi admin dashboard.
Beyond that, it seems like the src tag in your screenshot has a relative url - if you are not hosting the backend on the same path as the frontend, I would suspect you have to prepend the backend base path :-)

Laravel 5.7 getting images from storage

I have a little problem with getting an images from storage. Images are stored in storage/app/public/uploads/files directory. In database they are stored as file name image-1.png ... I am getting the files via url generated in Eloquent entity and url looks like src="/uploads/files/image-1.png" But cant see any image. Images are stored manually. Can somebody tell me please where is the problem?
If you generate the symbolic link, then your path will be :
/storage/uploads/files/image-1.png

how to add or edit gravitar within laravel

I know that we can user the gravitar in laravel for display pic but how can we add one if the new user doesn't have it or wish to update the current one from within the application?
below article shows how to show existing gravitar in laravel.
How do I implement Gravatar in Laravel?
You can supply a default image through the Gravatar URL.
Documentation.

Parse verification email with image

I am currently using Parse email verification to validate the user. Parse has given the option to send custom email for verification. My question is:
Is it possible to include an image in that email? I would like to show an image at the end of the text.
Thanks in advance.
Please use parse-mailgun-adapter for custom email templates From Here
Place your html files for custom templates in your root directory
you can use tag to place your images but don't forget to give it an absolute url with for example
< img src="https://www.aWebSite.com/anImageResource.png" />

Allowing tiff/tiff image files in Magento admin product image uploader

How do I allow tif/tiff files in the product image gallery uploader in Magento admin? I've already tried updating {Package}_Adminhtml_Block_Media_Uploader::__construct() with the following code:
$this->getConfig()->setFilters(array(
'images' => array(
'label' => Mage::helper('adminhtml')->__('Images (.gif, .jpg, .png, .tif)'),
'files' => array('*.gif', '*.jpg', '*.png', '*.tif', '*.tiff')
),
Though the uploader browse popup still filters/grays out tif's.
I've confirmed my local class is correctly overriding core. I also located xml config for file extensions in the CMS module, but that obiviously is not related here (right?).
The problem with tiff is, that GD2 is not able to do anything with this format. Therefore you need to change the Image_Adapter, e.g. to this:
https://github.com/magento-hackathon/Perfect_Watermarks
and afterwards you have to rewrite the uploder (maybe a observer can do this too) to change the format check and add tif, tiff
You are talking the image uploader within the WYSIWYG, correct? Prattski explains how with a simple module here: http://prattski.com/2011/01/10/magento-allow-other-file-types-in-wysiwyg-editor/

Resources