uploading file from specific location using rails_admin - ruby-on-rails

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.

Related

How do I allow images in a textbox | ASP.NET Core

I am developing an ASP.NET Core application & I need a control as described below:
Is there an existing control or a way to allow users to insert images in a textbox.
There is no way to simply insert an image into a textbox. WYSIWYG editors like TinyMCE give the appearance that this happening by rendering a HTML area with an img tag pointing to an image file at some location. In the end, what's submitted is this backing HTML, not the image itself.
For something like an image that already exists at some publicly-accessible location online, nothing more is required. However, if you're talking about allowing a user to embed an image that exists only on their local filesystem, that requires additional machinery. Again, WYSIWYG editors like TinyMCE often include something along the lines of a "file browser" or "upload" control that handles this type of thing. When the user picks an image from their computer, the control uploads that image to some location on the server and then, again, adds a simple img tag pointing to the now online location of that image. This has to be configured, though. There's usually server-side scripts that must be installed on the server and you have to somehow tell it both where to store the uploaded images and how to address them from a publicly-accessible URL. This is likely what you're missing with TinyMCE. However, setting all that up is beyond the scope of Stack Overflow. Consult the documentation for your library of choice.

zendframework 2 how do i upload images to a directory in my view

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.

rails- display image in another app's directory in my view

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.

How to show only the link of an uploaded file, not its location

I have used paperclip to allow me to upload files to a rails application. Everything works and the file is uploaded, but instead of seeing a link to the actual file itself I see the location of it within the systems folder of the rails project.
I'm guessing its either a routing issue or I need to create a link to the file in question. However, I would like to hide the location of the file itself, and only see the link displayed.
I would be very grateful if someone could point me in the right direction here.
You want to hide the actual path of the file in the server, right?
You can achieve that using send_file (http://api.rubyonrails.org/classes/ActionController/DataStreaming.html#method-i-send_file) in a normal controller.
You will still need to do something to protect the download using the real path.

I cannot add content to Weceem through the admin screen

I got Grails CMS (Weceem) up and running. Through the admin screen I have been able to modify existing text or add new HTML pages. However I cannot add any resources folders.
When I click on New Content and select Folder and enter a folder name, checked under "Parent & Children" and it said Parent: resources(Server Directory) so I hit save. It looks like it completes but nothing is created. I refreshed the screen, expanded the resources folder and my newly created folder did not show under resources
However when I go into the actual server through ssh client I can see that the folder got created under
/root/weceem-uploads/WeceemFiles/_ROOT/resources
But yet it does not appear on the admin screen.
Anybody know why?
Thanks,
I guess I had to choose Server Directory instead of Folder. I guess it was misleading because if I choose folder it also puts it under the server directory (at least according to the Parent label under the Parent & Children section

Resources