I'm using storage SFTP module for saving media now i'm facing issues to open image url path as we know there is no media is project directory because i am using sftp.
Please suggest me the best way to render back end images using django rest.
Detailed info: models, view and setting
Related
I have a requirement where i have to share the images from the web url .I want to use this image in my app share contract. For this I am following the tutorial at this link. Only issue is that in the tutorial, file is selected using filePicker.Can you please provide any points on sharing the image from the url instead of file picker ?
I have a use case where an angular front end will need to submit image and Django Rest Framework API will need to save it to filesystem during image upload calls. During image download scenario the image will need also be served up from filesystem.
If someone already figured out this usecase please post it. Help will be highly appreciated.
Django REST framework provides an ImageField that can handle the uploading of images using Django's file upload handlers. So you might be interested in learning how it is done in Django first: Need a minimal Django file upload example
If i have a filename for a local file on the computer:
$img = "deskfile:///D%3A%2FSCANS%2F%23AUKT%2Fimg2014%2F2014-06+SP%2FEPSON007.jpg"
how can i upload it the server without using the "file selector"?
If i enter the file adresses in the url window of a browser i can display the image.
But if i load the image in tag they won't display. I've read it's becuse of restrictions in the browser.
I can't add a value caluse to the either.
Is there anyway to upload the image from the string?
Or can i at least open the correct directory in the "file selector" so the user wont have the browse the whole computer when looking for the file?
Yes there is a way. You can use the File API with Html5 and/or a polyfill for this to load the image in the browser before posting it back to the server. The best such polyfill that I know of is called Moxy/Plupload. It includes Flash and Silverlight fallbacks for older browsers.
You can display the image because it is stored locally in your computer. How do you know where is the image going to be in the user's computer. The only way to access the user's file system is through the file selector, once the user has selected a file you can then use any API to save that file in the server on your terms, but you will not be able to see each of your users file system from you page (security reasons). Could you elaborate more in what you are trying to accomplish? What exactly are you trying to do?
i try to create a web site where it will provide an option to the user to upload a pdf file. I want this pdf to be saved on the server with specific url. For example:
The user select the title.
The user upload the file.
I want after these actions the file to be accessible via a specific url/name_the_user_give.
I saw that the Spring MVC provides very easy interface for file uploading.I already see many tutorial about this but my problem is how can i save the paper into a server.Also i want the pdf to open by the browser's tools.Can anyone give me directions?
To save the file on server path you simply needs to write the file stream to the path described by
request.getServletContext().getRealPath("your directory name here");
and then create the file using the real path you get.
And to show the pdf file using browser plugin, you should use following in your controller method.
#RequestMapping(value="url to map", produces={"application/pdf"})
Hope this helps you.
Cheers.
Images can be uploaded through Drupal's frontend interface with the Image module. However, I'd like to be able to upload and create image nodes remotely by requesting a URL and passing the image as a parameter. I have the REST API module, which works fine, but I can't figure out what function I need to call in the backend to create the image node. Does anyone know how to do this or if there's another module that does something like this?
Thanks.
The Gallerix module lets you turn on "Repository mode" that will make any images uplaoded to an FTP folder available to be included in its image galleries. It would be a simple step from there using Drupal 6 triggers and actions to publish a node containing only that image.