image-uploading

Flutter: http post upload an image

走远了吗. 提交于 2019-11-27 01:49:36
问题 I use a web service for image processing , it works well in Postman: Now I want to make http request in flutter with Dart: import 'package:http/http.dart' as http; static ocr(File image) async { var url = '${API_URL}ocr'; var bytes = image.readAsBytesSync(); var response = await http.post( url, headers:{ "Content-Type":"multipart/form-data" } , body: { "lang":"fas" , "image":bytes}, encoding: Encoding.getByName("utf-8") ); return response.body; } but I don't know how to upload the image file,

in asp.net-mvc, is there a good library or pattern to follow when saving users content (images, files, etc)

筅森魡賤 提交于 2019-11-27 01:41:23
问题 i have an admin section of my website where "authors" can upload files like pictures for photo galleries, etc to include in dynamic content sections of my website later. I have certain pages where the html itself is stored in my mySQL database and users can edit the content using ckeditor interface. i am trying to see if there is something to leverage that will save files to the right directory and retrieve them later or i should just write this all from scratch. Also, looking for lessons

How to preview picture stored in the fake path in Angular 2/Typescript?

旧巷老猫 提交于 2019-11-27 00:08:56
问题 Browsers don't take full path of local disc, instead they concatenate the filename with fakepath. Is there any way to access the file (image) from fakepath using typescript or angular 2? I have this: <img src="{{path}}" /> where my path variable stores the 'fakepath':"C:\fakepath\pic.jpg" in my .ts file. Edit This question discusses the way to preview image file from fakepath using javascript. If it is possible with Js, then is it not the same in case of ts? 回答1: This should do what you want:

Upload image using jquery

情到浓时终转凉″ 提交于 2019-11-26 22:02:08
问题 I have a working php code to upload image in the database. Is it Possible to transform it to jquery? If so, what do I need to do? I am new to jquery btw. Thanks This code works just fine. But I need to do it in jquery. <form action = 'upload.php' method = 'post' enctype="multipart/form-data"> <input type="file" name="image" > <br> <input type= 'submit' value = 'Add' id = 'Add' name = 'Add'> </form> <?php if(isset($_FILES['image'])) { $target_Path = "images/"; $target_Path = $target_Path

Android upload image to server using base64

情到浓时终转凉″ 提交于 2019-11-26 21:44:16
问题 I am uploading image to server using base64 its working fine if image is small but if image is big it gives me memory out exception try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); bitmap.recycle(); byte[] byteArray = stream.toByteArray(); stream.close(); stream = null; String ba1 = Base64.encodeToString(byteArray, Base64.DEFAULT); bitmap = null; System.gc(); // immediately free bitmap byteArray = null; System.gc();

Convert byte[] to image and display on jsp

一世执手 提交于 2019-11-26 21:22:18
问题 I'm trying to display an uploaded picture (which is now a byte array) on a jsp page. Now, the byte[] column exists in the database and has to be converted to an image. This is what I've been trying: Part of the table on jsp page: <c:forEach var="user" items="${userList}"> <tr> <td>${user.fileName}</td> <td> <img src="data:image/jpg;base64,${user.imageFile}" alt="No image"> </td> Part of the controller that takes an array of bytes from a MultipartFile object: @RequestMapping(value = "/register

Image Uploading - security issues

隐身守侯 提交于 2019-11-26 20:26:45
问题 I'm developing an ASP.NET Web app and would like the user to be able to either upload an image from their local system, or pass in a URL to an image. The image can either be a JPG or PNG. What security issues should I be concerned about doing this? I've seen various ways of embedding code within JPG files. Are there any methods in C# (or external libraries) which can confirm that a file is a JPG/PNG, otherwise throw an error? At the very least, I'm making the directory which holds uploaded

Image resize by Javascript

怎甘沉沦 提交于 2019-11-26 20:21:52
问题 I've web app running. And it uses ajax upload. The issue is recently users are uploading too big images. So it's taking a bit more time. Users are complaining about that. So what I was thinking is this, 'If I somehow crop and resize the image via js and then send it to the server via ajax upload then the time will be reduced'. So is there any way to do that? Any idea for it? 回答1: A solution is to use modern ways like FileReader and Canvas (But this works only on the latest modern browsers).

How to send multipart/form-data with Retrofit?

假装没事ソ 提交于 2019-11-26 19:43:25
问题 I want to send an Article from and Android client to a REST server. Here is the Python model from the server: class Article(models.Model): author = models.CharField(max_length=256, blank=False) photo = models.ImageField() The following interface describes the former implementation: @POST("/api/v1/articles/") public Observable<CreateArticleResponse> createArticle( @Body Article article ); Now I want to send an image with the Article data. The photo is not part of the Article model on the

javascript: upload image file and draw it into a canvas

…衆ロ難τιáo~ 提交于 2019-11-26 19:12:48
问题 I work at a web application for painting images. I use a CANVAS element and javascript to draw on it, but I have a problem: how can I load an image from the pc of the user and draw it on the canvas? I don't want to save it on the server, only on the webpage! Here is a shortened version of the code (the full code would be too long): HTML: Open file: <input type="file" id="fileUpload" accept="image/*" /><br /> <canvas id="canvas" onmousemove="keepLine()" onmouseup="drawLine()" onmousedown=