I have worked for Image binding for listbox. For that I have binded the Image Url to Image Source. My proplem is someURL not valid does not contain image. Normally I have loaded defalut image for no url contains items.
That not valid url, binded the image as empty pixel. In this i want to show default image. If no pixel in image means, binding not needed.
string Url="Some URl.jpg";
Binded this "URL" to the Image.
Pls Help me
For this try to give a background image in your image content which is equal dimensions of ur image content..by default it shows the background image when no image in the URL.
Use Stackpanel at background, so when image is loading , it will show by default color of stackpanel, and when image is loaded it will show Image, thereby hiding the background color
StackPanel background = new StackPanel();
background.Background = new SolidColorBrush(Colors.LightGray);
Image img1 = new Image();
img1.Height = 250;
img1.Stretch = Stretch.UniformToFill;
LowProfileImageLoader.SetUriSource(img1, new Uri(n.Image, UriKind.RelativeOrAbsolute));
background.Children.Add(img1);
Related
I'm working on a new UI-element in an vb6 programm. I need to place pictures dynamically on 2 diffenent colored background lines:
I tried out two different ideas but none of them is working:
Idea 1
I used image control and assigned an image to the control. Then I set left, top, with and hight properties to values where I want to place the image. Image was places at correct position but not in foregound on a frame but in background (behind coloured frame).
Can anyone tell me how I can place an image control in foreground (on green coloured frame)? I need to place these image controlls dynamically from code in running program.
Idea 2
In second sulution I tried to use picturebox instead of image control. Picturebox can be placed on colored background (frame) without any problems.
Here the problem is that loaded picture has to be scaled to size of picturebox picture property. Picture is loaded to picturebox by following code: Picture.Picture = LoadPicture("F:\img.JPG")
Does anyone know how I can scale this img to size of picturebox?
Can anyone help me to follow up one of the solutions. In principle I would prefere to use Image controls if it is polible to place them in foreground on frame.
I'm going to guess that after creating the image control, you are moving it onto the Frame. If so, this is why the control is behind the Frame. You really want the image to be inside the frame. The key to do this is to set the Container property.
Dim img As Image
Set img = Me.Controls.Add("VB.Image", "Image1")
If Not img Is Nothing Then
img.Move 200, 200, 400, 400
img.Stretch = True
img.Picture = LoadPicture("your image.jpg")
Set img.Container = Frame1
img.Visible = True
End If
I have a similar issue. I am loading photo of a person into StackPane/ImageView from a file. At this time the image looks like original. Upon Save button being clicked, the image is inserted in database BLOB field. In SQL, when you view this, the image appears perfectly normal. On View / Modify options, I retrieve the Blob and convert it to Image and load it in the same Imageview. But now it appears with a reddish Background.
This is the correct image at the time of loading from file
But this is how it appears when I display it from Database
I did this to my CSS file and it works.
.scrollPane.disabled {
-fx-opacity: 1.0;
-fx-background-color: cornsilk;
}
.scrollPane {
-fx-opacity: 1.0;
-fx-background-color: cornsilk;
}
This is the order of my nodes.
Scroll Pane
Stack Pane
Image View
Image
I am displaying any size image to fit in a 175x175 frame so it loses its original shape on the category page.
I want to display category image after resize that like product image is resized and displayed.
How can I do this in Magento 1.7.0.2?
You will have to maually resize using Magento's image libs, herwes an example (http://blog.chapagain.com.np/magento-resize-image/):
// actual path of image
$imageUrl = Mage::getBaseDir('media').DS."myimage".DS.$post->getThumbnail();
// path of the resized image to be saved
// here, the resized image is saved in media/resized folder
$imageResized = Mage::getBaseDir('media').DS."myimage".DS."resized".DS.$post->getThumbnail();
// resize image only if the image file exists and the resized image file doesn't exist
// the image is resized proportionally with the width/height 135px
if (!file_exists($imageResized)&&file_exists($_imageUrl)) :
$imageObj = new Varien_Image($_imageUrl);
$imageObj->constrainOnly(TRUE);
$imageObj->keepAspectRatio(TRUE);
$imageObj->keepFrame(FALSE);
$imageObj->resize(135, 135);
$imageObj->save($imageResized);
endif;
$newImageUrl = Mage::getBaseUrl('media')."catalog/category/resized/".$imageName;
If you take a look at Varien_Image you will see there's a few different methods to help resize images. Unfortunately there's no helper to use as there is for product images, although it wouldn't be difficult to make a helper to do this.
I have used this code (kind of tutorial) at http://code.google.com/p/gwt-examples/wiki/gwt_hmtl5 ... In this code, I used the "Image Scale / Resize" code and I found something that I cannot explain. I mean, instead of using :
final Image img = new Image("/img/test.jpg");
I have used the client bundle and so the following code:
final Image img = new Image(NormalResources.NORMAL_RES_INSTANCE.axl1());
And I do not have any error, but the image did not appears. Finally I found the solution with :
final Image img = new Image(NormalResources.NORMAL_RES_INSTANCE.axl1().getSafeUri());
Do you know the reason why ".getSafeUri()" solves the problem ?
See ImageResource in ClientBundle as real <img> element
An Image created with an ImageResource will unconditionally use a clipped image, where the image is set as a CSS background image (and the <img>'s src is a 1×1px transparent GIF). Because the image actually is a blank GIF, painting it to the canvas does nothing noticeable; canvas does not take CSS styles into account.
Using getSafeUri() you'll have the data: URL of the image, which will be used as the src of the <img>. No blank.gif here, so the image is correctly painted on the canvas.
Note however that getSafeUri() won't work in IE6 and IE7 by default. If you need to support them, you'll have to annotate your ImageResources with either #ImageOptions(preventInlining = true) or #ImageOptions(repeatStyle = RepeatStyle.Both). Alternately, you could use DataResources instead of ImageResources.
Okay this solution seems to not be findable.
I have a border type image on stage (circular) and I am dynamically loading an image from xml in my document class. I have a place holder image inside the border. Can I replace that image with the one that is dynamically loaded?
Or do I have to addChild and then scale and transform it all through code?
I would just remove the place holder image and add the new image into the same container and scale/position it. It is simple to do with code.
container.removeChild(placeHolderImage);
container.addChild(newLoadedImage);
newLoadedImage.scaleX = newLoadedImage.scaleY = 1.5;
newLoadedImage.x = 100;
newLoadedImage.y = 100;
You can possibly draw into the bitmap data of the image already on screen but I don't see any downsides with just removing the old one and adding the new image.