imagesource

Retrieve image from FTP to webpage

一个人想着一个人 提交于 2019-11-27 02:11:10
I have a folder in my ftp server which contains several images. I'm trying to access and show these images in a webpage like <img src="ftp://my_ftp_ip_address/Images/imagename.jpg"/> But it asks for an FTP username and password. How can I achieve this? Also is it possible to do the same using Java? With the latest versions of web browsers ( Chrome 59 , Firefox 61 ), you cannot even use ftp:// URL to retrieve an image. And it was never a good solution anyway. The correct solution is to route the image through your webserver, hiding away not only the credentials, but also the original source of

BitmapImage to byte[]

独自空忆成欢 提交于 2019-11-27 01:17:14
I have a BitmapImage that I'm using in a WPF application, I later want to save it to a database as a byte array (I guess it's the best way), how can I perform this conversion? Or, alternatively, is there a better way to save a BitmapImage (or any of its base classes, BitmapSource or ImageSource ) to a data repository? To convert to a byte[] you can use a MemoryStream: byte[] data; JpegBitmapEncoder encoder = new JpegBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(bitmapImage)); using(MemoryStream ms = new MemoryStream()) { encoder.Save(ms); data = ms.ToArray(); } Instead of the

Detect when an image fails to load in Javascript

心已入冬 提交于 2019-11-26 18:52:32
Is there a way to determine if a image path leads to an actual image, Ie, detect when an image fails to load in Javascript. For a web app, I am parsing a xml file and dynamically creating HTML images from a list of image paths. Some image paths may no longer exist on the server so I want to fail gracefully by detecting which images fail to load and deleting that HTML img element. Note JQuery solutions wont be able to be used(the boss doesn't want to use JQuery, yes I know dont get me started). I know of a way in JQuery to detect when an image is loaded, but not whether it failed. My code to

Embedding resources (images, sound bits, etc) into a Java project then use those resources

一个人想着一个人 提交于 2019-11-26 13:03:32
问题 I have searched for a method of embedding a resource in a java project (using Eclipse v3.6.0) then using that embedded resource within a control (e.g., JLabel ). I have seen methods of referencing resources from the file system. Once the project has been developed I would like to publish the application as an executable. It should be noted these executables will be deployed/launched to Windows, *NIX, and Linux platforms. I know this can be done in the Visual Studio world, but I\'m very

Retrieve image from FTP to webpage

前提是你 提交于 2019-11-26 09:59:23
问题 I have a folder in my ftp server which contains several images. I\'m trying to access and show these images in a webpage like <img src=\"ftp://my_ftp_ip_address/Images/imagename.jpg\"/> But it asks for an FTP username and password. How can I achieve this? Also is it possible to do the same using Java? 回答1: With the latest versions of web browsers (Chrome 59, Firefox 61), you cannot even use ftp:// URL to retrieve an image. And it was never a good solution anyway. The correct solution is to

BitmapImage to byte[]

让人想犯罪 __ 提交于 2019-11-26 09:39:03
问题 I have a BitmapImage that I\'m using in a WPF application, I later want to save it to a database as a byte array (I guess it\'s the best way), how can I perform this conversion? Or, alternatively, is there a better way to save a BitmapImage (or any of its base classes, BitmapSource or ImageSource ) to a data repository? 回答1: To convert to a byte[] you can use a MemoryStream: byte[] data; JpegBitmapEncoder encoder = new JpegBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(bitmapImage));

Detect when an image fails to load in Javascript

蓝咒 提交于 2019-11-26 06:37:35
问题 Is there a way to determine if a image path leads to an actual image, Ie, detect when an image fails to load in Javascript. For a web app, I am parsing a xml file and dynamically creating HTML images from a list of image paths. Some image paths may no longer exist on the server so I want to fail gracefully by detecting which images fail to load and deleting that HTML img element. Note JQuery solutions wont be able to be used(the boss doesn\'t want to use JQuery, yes I know dont get me started

How do I change an image source dynamically from code-behind in WPF with an image in Properties.Resources?

人走茶凉 提交于 2019-11-26 01:30:02
问题 I have a WPF application that needs to provide feedback to the user about an internal state. The design is to have three images, call them Red, Yellow, and Green. One of these images will be displayed at a time depending on the state. Here are the points: The three images are in Properties.Resources in the code-behind Only one of the images will be shown at a time. The state change comes from a process in code-behind and not from the user. I would like to bind an image control so that I can