I'm working on a Rails app which consumes the Instagram API to get a set of pictures. I want to store those pictures locally using CarrierWave to remote upload them. I know if you're using a controller, you can supply a url as the remote_image_url variable and CarrierWave natively knows what to do.
My question is: how can I get CarrierWave to do this from the Model? As I don't have a controller since I'm getting everything from the API.
Many thanks!
You can set remote_image_url anywhere, not just in a controller.
Related
I was checking Imageresizer S3 Reader2 plugin, and I have the following question.
My app is basically a c# REST API that has a functionality of serving
photos (resized photos).
Would it be possible to use Imageresizer+Amazon S3 with REST API so I can resize
photos in with Imageresizer in c# before serving it and without transferring original photo over network?
You'll have to transfer the original photo from S3 to your server (at least once) in order to resize it. The S3Reader2 plugin does this automatically. If you want to prevent repeat requests, look into SourceDiskCache.
Otherwise, that's exactly how ImageResizer+S3Reader2 functions.
I am using Core Api from drop box to upload and download file. The upload and download take place from my device. So the image is stored locally and then uploaded. And when downloaded they store on device and I pull them from their locations.
I am able to access the metaData dropBox provides via the restClient LoadedMetaData method. However that method doesn't provide support for the GPS. In this blog Post from dropBox https://www.dropbox.com/developers/blog/86/new-additional-information-about-photo-and-video-files
it has an update to access this. But it is done using a GET HTTP request. Can I do this from inside xcode? I tried accessing the request directly and it gives an error of "NO AUTH" so I cant grab the JSON file. But we should already be authorized from signing in directly with the api.
Any help would be so appreciated.
I believe that in the Core SDK, you can just call [client loadMetadata:path withParams:#{#"include_media_info": #"true"}];
(Caveat: I haven't tested it myself. Please let me know if it works.)
I am creating a mobile app through Phonegap as the client and using Rails as the back-end. I am deploying my app to Heroku and am planning to use S3 to store the image files, because that is what is recommended from my various readings online.
I was wondering how could the Rails controller be used to send images back from Ajax requests from Phonegap.
I am not sure how to write the back-end API code to send images to requests.
I also read that using the send_file method without x-send_file enabled will slow down the server because sending the image would block other request until it is done.
Please let me know if you have any insights.
You could use redirects to the S3 assets here, then your browser is just getting the image directly, and not holding up one of your server processes while the browser slowly downloads the images.
If you need to keep your images private you can use the signed URL feature of S3 to only give signed and time limited URL's to the appropriate users. (See my commit to Paperclip: https://github.com/thoughtbot/paperclip/pull/292)
I am developing an iPhone app in Appcelerator Titanium. My app is communicating with an API that I build using Rails 3.
I want to be able to upload an image from the iPhone app to the API (and Amazon S3). I am using the gem called Paperclip. Along with the upload request I need to send the name of the file. But if I do it like below, the image_file_name is not recognized. What is wrong with the call?
In the App: http://pastie.org/1805065
In the API model: http://pastie.org/1805071
In the API controller: http://pastie.org/1805073
Output on the API server: http://pastie.org/1805078
Looks like in the API Controller the line:
#avatar = Avatar.new(params[:avatar])
Should read:
#avatar = Avatar.new(params[:image])
Explanation:
This conclusions was made by looking at the server log output from the API Server, and checking the Parameters hash for the name of the submitted image. Instead of it being named "avatar" as your controller was expecting, it appears to actually be named "image".
I'm trying to get S3 SWF Uploader plugin working on my Heroku hosted RoR app.
At this point i have it installed, and i can upload files to my Amazon bucket... that's great!
But how can i get my hands on the callback functions? I simply can't find them!
Thanks
He has a list of all the Javascript callbacks in the README on GitHub: https://github.com/nathancolgate/s3-swf-upload-plugin
He also has a sample app which shows the code and how he's using the callbacks: http://s3swfuploader.heroku.com/
The one you'd be interested in is: :onUploadingFinish ()