I have a few rails apps set up- one is for admin and the other for signup.
The admin app has a folder for photos "adminapp/u_photos/photo_browse/photos"
On the signup side I have a public form that dispays the contents of that directory via ruby's 'find' gem and a controller action that finds them.
When a user on the signup form clicks "browse images," a modal pops up and allows them to search through the images, returning all files that match (list of files).
How would I display a thumnbnail of the image next to the file name?
Thank you
I found the answer while searching:
Rails 3, displaying jpg images from the local file system above RAILS_ROOT
This worked perfectly, and described what I needed, which was was displaying multiple images on one page.
Related
i have a quick question and would really appropriate some advice.
i am trying to upload images to a directory held in in the view of a module.
the full link to the pic's directory in 'my member's module' is:
C:/Users/test/zend/testingZend2/module/Members/view/members/pics
however, the upload function is held in MembersController :
C:/Users/test/zend/testingZend2/module/Members/src/Members/Controller/membersController
i am able to upload images to the directory. however, i obviously don't want to use the full URL. i want to use a relative link.
i tried the relative links below but they don't work;
Members/view/members/pics
and
../../../view/members/pics
is there for example a function like dirname(DIR) that will provide the first half of the link to the pics directory.
thank you for your help
Paths are relative to the application root, so module/Members/view/members/pics should work.
I would question whether the view folder is a sensible place to store user-uploaded images. Images aren't views, and you won't be able to display these images easily since they are not in a public folder.
Currently I am using rails_admin gem. Everything is connected, and everything is working as it should.
When I go to /admin, I pick a product for example, going Add new and then in new window I have option like image url (which supposed to take name of image for example test.png and that's it).
What is bothering me, I would like to somehow enable that when I fill all options, and enter image url, also add a browse option near it, so when user/admin clicks on Add Product at the bottom of the page, image is loaded (from that PC) and added into folder in assets directory I created assets/images/MyFolder.
I am starting up with rails and was going thru the sharebox-tutorial.
Now is it possible with paperclip to first preview the uploaded files and then choose the download link, rather than the file directly being downloaded when link is clicked, as in the tutorial and elsewhere in the internet.
Also, what will be the method to generate a share link unique to every friend email.
While researching, i also found out that files should be uploaded in some other folder but public.
how is it different from storing the files in public folder with the url hashed. the hash url is still accessible when user is logged out.
UPDATE
the preview i am referring to should be after uploading.
I need to individualize documents within an iOS-App. I could provide the origin-documents as DOCX, PDF, PPT etc. The output-format has to be PDF.
My minimun requirement is to fill some text-fields. Nice to have would be to replace an image, too.
I´m quite used to generate PDFs programmatically using UIGraphicsBeginPDFContextToFile etc. But in my current case I don´t want to create the whole document programmatically, I just want to replace some content.
Any hints / tipps?
Thank you in advance.
DOCX is a zip - format file so you can process the contents programmatically and the reconstruct the zip file. PPT is a binary format though newer versions of PowerPoint might also construct zip-oriented versions that you can programmatically process. You mentioned though that you need don't want to programmatically process these documents - which I would probably also do only as a last resort.
For your DOCX origin/source documents (or doc,odt,rtf but not ppt/pdf) you could use Docmosis cloud services if your app can have the external dependency. You would upload your DOCX origin documents with placeholders for text-fields or images as a one-off/occasional task. Your iOS app then calls Docmosis sending instructions and data to create the output PDF and either stream it back to the app or email/store it or both.
The upside is it takes all the load and coding away from the iOS application (there is an SDK). The downside is it is an external depdendency. Please note I work for the company the created Docmosis.
Hope that helps.
Why not just load a page in a webView modal that points to a URL of a page you create? The main parts of the page would be static, and then the fields you need to customize would be populated via Javascript or PHP.
For example, we have a contact form in our app that gives you an option to view the details of your completed form after you submit. When the user clicks on the button to view the Contact Confirmation, it loads example.com/confirmation.php in a modal view within the iOS App.
On the confirmation.php page (on the web), I use PHP to pull in $_GET variables from the URL parameters which then populates the page with my static content, and their customized information that they entered into the form.
I have a rails app, where Im having a drop box like feature-set.
Each user has a login an password
Each user can upload and download their own files.
On their index page they see all the files they have uploaded.
The urls to the files are saved in the db: within heroku
I have a few questions on how to approach some functionality that Id like to add to the app.
1) I, as an admin, would like to add files to the users folders, which will show up when the user logs into their app next time. Currently even if I drop the files in the folders users cant see it becuase their index.html page pulls up only those files that have their urls stored in the db
2) Currently file acces is by url so its public. This is a big problem. I would like to set up the app such that the url is not public. Since Im using heroku I cannot store them on the heroku servers and I wouldn't want to stream them into the app and then provide them to the user through Heroku. So whats the best way to server them directly from S3 but not reveal the url.
Thanks for your help
I think the answer to 1) is to create an action that allows the admin to create a file object and associate it with a user.
As for 2) (and this should help with figuring out 1), incidentally), the Paperclip gem supports attaching files to a model, with an option to store the file on S3 (and the ability to specify the URL to that file).
Here's one of many related tutorials that walks through some considerations for protecting access to those files.