base64

HttpServerUtility.UrlTokenDecode fails “sometimes” (Invalid length for a Base-64 char array.)

孤者浪人 提交于 2020-01-01 19:44:08
问题 We have an IHttpHandler for stylesheets and add a <link/> tag to the page like this: HtmlGenericControl link = new HtmlGenericControl("link"); link.Attributes.Add("rel", "stylesheet"); link.Attributes.Add("href", "stylesheet.axd?d=" + HttpServerUtility.UrlTokenEncode(token)); head.Controls.Add(link); In the stylesheet.axd handler, we UrlTokenDecode the d query string parameter like this: var token = HttpServerUtility.UrlTokenDecode(Request.QueryString["d"]); This works most of the time but

How can I create a Base64-Encoded string from a GDI+ Image in C++?

眉间皱痕 提交于 2020-01-01 19:32:24
问题 I asked a question recently, How can I create an Image in GDI+ from a Base64-Encoded string in C++? , which got a response that led me to the answer. Now I need to do the opposite - I have an Image in GDI+ whose image data I need to turn into a Base64-Encoded string. Due to its nature, it's not straightforward. The crux of the issue is that an Image in GDI+ can save out its data to either a file or an IStream*. I don't want to save to a file, so I need to use the resulting stream. Problem is,

How can I create a Base64-Encoded string from a GDI+ Image in C++?

五迷三道 提交于 2020-01-01 19:32:00
问题 I asked a question recently, How can I create an Image in GDI+ from a Base64-Encoded string in C++? , which got a response that led me to the answer. Now I need to do the opposite - I have an Image in GDI+ whose image data I need to turn into a Base64-Encoded string. Due to its nature, it's not straightforward. The crux of the issue is that an Image in GDI+ can save out its data to either a file or an IStream*. I don't want to save to a file, so I need to use the resulting stream. Problem is,

Why does UIWebView shrink images?

爷,独闯天下 提交于 2020-01-01 18:16:12
问题 I'm using a UIWebView to display images in base64 (http://www.abluestar.com/utilities/encode_base64/index.php). The UIWebView is set to "Scales Page To Fit" and Mode is "Left". The image might be 400px wide but once rendered in the UiWebView, it takes up not even half of the screen. I need to do something like style="width:800px;..." before it begins to take up most of the screen and is readable (because it isn't so small). Is this the right way? Why does the image shrink in the UIWebView and

Why does UIWebView shrink images?

牧云@^-^@ 提交于 2020-01-01 18:15:06
问题 I'm using a UIWebView to display images in base64 (http://www.abluestar.com/utilities/encode_base64/index.php). The UIWebView is set to "Scales Page To Fit" and Mode is "Left". The image might be 400px wide but once rendered in the UiWebView, it takes up not even half of the screen. I need to do something like style="width:800px;..." before it begins to take up most of the screen and is readable (because it isn't so small). Is this the right way? Why does the image shrink in the UIWebView and

cant upload picture using Base64 in iphone app

风流意气都作罢 提交于 2020-01-01 17:07:14
问题 i ask this before in this forum but it was closed i dont know why, so i post my question again. in an iphone app i have to upload a picture using Base64 encoding, but when i look in the server the picture is all white ( size = 0x0 ,54 KO ), im sure that my Base64 encode of my pic is correct because i have a php script ,i use it and the picture appear normally. here is the php code used to upload : <?php $filename = "photo_to_upload.jpg"; $handle = fopen($filename, "r"); $imgbinary = fread(

Send a Base64 encoded image through HTTP Post Request from Android

随声附和 提交于 2020-01-01 15:29:52
问题 I am completely lost, I am trying to send a photo via an android app to a php webpage. Theoritically everything should be right but the destination data is corrupted or something I don't know... I can get the post data, I tried with a simple string it worked fine but with a heavy file the data seems corrupted. public class EncodingAndSending extends Thread{ ShareOnMyWebSiteActivity mycontext; ContentResolver cr; Uri uri; public Handler mainHandler,sHandler; public EncodingAndSending

PHP: Shorter/obscured encoding for a URL embedded in another URL?

我们两清 提交于 2020-01-01 10:04:06
问题 I'm writing myself a script which basically lets me send a URL and two integer dimensions in the querystring of a single get request. I'm using base64 to encode it, but its pretty damn long and I'm concerned the URL may get too big. Does anyone know an alternative, shorter method of doing this? It needs to be decode-able when received in a get request, so md5/sha1 are not possible. Thanks for your time. Edit : Sorry - I should have explained better: Ok, on our site we display screenshots of

Modify response body retrofit 2.2 interceptor

邮差的信 提交于 2020-01-01 06:56:20
问题 I'm developing an app using Retrofit 2 to request to API. This API is in ASP.NET and it is zipping with GZip and encoding to Base64, like the code below: private static string Compress(string conteudo) { Encoding encoding = Encoding.UTF8; byte[] raw = encoding.GetBytes(conteudo); using (var memory = new MemoryStream()) { using (GZipStream gzip = new GZipStream(memory, CompressionMode.Compress, true)) { gzip.Write(raw, 0, raw.Length); } return Convert.ToBase64String(memory.ToArray()); } }

Uploading large images using Base64 and JSON

一世执手 提交于 2020-01-01 05:15:16
问题 I am using this function to upload an image to a server using JSON . In order to do so, I first convert the image to NSData and then to NSString using Base64 . The method works fine when the image is not very large but when I try to upload a 2Mb image, it crashes. The problem is that the server doesn't receive my image even though the didReceiveResponse method is called as well as the didReceiveData which returns (null) . At first I thought it was a time out issue but even setting it to 1000