Creating a table entry while using CarrierWaveDirect - ruby-on-rails

Is it possible to use something like CarrierWaveDirect to upload directly to S3 and still be able to gather some data on the files being uploaded?
For instance, is it possible to change the filename, and save the size in a table before/after the upload? I don't need to do any kind of manipulation to the file either (I was reading some documentation regarding the use of Resque).
I realize that this is a very novice question but I couldn't find the answer anywhere.

After a lot of fiddling, I found out that the S3 secure upload form that the hidden field success_action_redirect returns so params on the uploaded file.

Related

configure paperclip to generate styles when they are requested

I need a user to upload an original file and process that into a thumbnail (paperclip's got this - check).
Then I would like to be able to retrieve different styles for that attachment, but I do not need to store those different styles on disk anywhere. I would prefer they are generated during the request.
The reason for that is that these styles are single-use. So, paperclip becomes a glorified one-time-use image resiszer. I'd prefer not to incur the S3 cost if I don't have to.
Wondering if there'a way to do this out of the box. Or, maybe carrierwave supports something like this?
Thanks!
I'm pretty sure that the Refile library supports it. Refile is basically a modern version of the Carrierwave, written by the same author.
You can read more about the on-the-fly processing here:
https://github.com/refile/refile#processing

How would you upload an image URL to an external website which generates a new URL for it and retrieve the newly generated url in rails?

I am creating a website which allows users to post links to gif images stored externally. Unfortunately gifs are terribly expensive and luckily I have found the following website which compresses them quite radically: http://gfycat.com/
Currently my app stores the url to the linked image (as of yet it is uncompressed and without the use of gfycat)
What I would like to do is to take the url that the user posts, use it to compress the gif via gfycat.com and then store the newly generated url (pointing to the compressed image) in my database.
How would I do this?
Sorry for the long explanation btw
Just took a look at gfycat.com, seems like they do have an accessible webservice at http://gfycat.com/fetch/:url
If this is the case, and you already have the URL you can very easily grab the 'minified' version of the gif by grabbing the URL and saving the file.
So, I would probably do something like this:
Install carrierwave or another image upload gem of your choice
In the case you used the above gem...
assuming Cat is your model, and you have an uploader attached to it named gif_photo, and also assuming the original 'gif' url is stored as original_gif_url
You can do something like the following (assuming #cat is some instance of the cat model):
#cat.update_attribute(:remote_gif_photo_url, "http://gfycat.com/fetch/#{#cat.original_gif_url}")
as simple as that :)... to get back at the gif, you can simply call #cat.gif_photo_url
(again, assumptions for code above are using carrierwave syntax, but can easily be done with any of its alternatives.)

Is there a way to save remote urls as they are with CarrierWave?

Is there a way to configure CarrierWave to not download remote images but save the urls as they are?
This is probably a strange question, but there is a case that we do not care the real size of the image if it comes from somewhere outside our website.
Update:
Why not just use a string field to store the url?
Because not all images come from remote urls, some of them are uploaded by users.
I'm just curious if there is a way to configure CarrierWave like that.
Why use carrierwave so? Just use a string field to store the url.

Setting profile pic from an upload OR an external URL using Paperclip

I would like to let my users set their profile picture by either:
Providing a remote URL into a text box that I will use to grab the image into an S3 bucket
Uploading a file using SimpleForm's file_field method
I would love to know the cleanest way to allow users to do both of these from the same form. I have done some experimenting but not come up with anything particularly satisfactory yet. Thanks.
The following is a good guide giving a general idea how to do an upload via a url. Its very old but it gives a good general idea of what needs to be done.
http://trevorturk.com/2008/12/11/easy-upload-via-url-with-paperclip/
After doing something like the above, first I would start with both the url and upload field disabled. Then I would just have some javascript, and a buttons that upon selecting url or upload un disabled the corresponding field by removing attribute disabled.

Parse word docs heroku/s3

I want to implement a functionality that needs to parse word docs, which will uploaded by user and stored on amazon S3. The application will be on heroku. I tried catdoc but it doesn't parse urls. Can anyone suggest tool that can be used on heroku to parse word documents?
UPDATE
I want to scan an uploaded ms-word(.doc) has particular words and tag them accordingly.
If you're just wanting to upload the word document you could take a look at something like the paperclip gem.
This would allow you to save the file on amazon S3 and simply download it, but you could also extend paperclip and run post-processing on the file. This is slightly more complicated.
Like willglynn says, it would be good to know what parsing you need to do, exactly?

Resources