Loading an ImageIcon from a source - image

i am making a game and i put some images on my ide/images folder but program gives null pointer exception error.my code for loading imageicon is like this
ImageIcon ac=new ImageIcon(getClass().getResource("images/actor.jpg"));
ImageIcon ac1=new ImageIcon(getClass().getResource("images/actor_shoot.jpg"));
//some codes
Image n=ac.getImage();
//some codes
i tried but couldn't find,whats your suggestions?thanks.

Try with an absolute path ? ("/images/actor.jpg") ?

Is your folder /images resides in same diretory in which your class is?
i.e., is your class is also in /ide folder?

Check the path. Are the files really in the images folder?
Are they called what you say there are called?
Are they the right case, if you're on a case-sensitive file system (in other words that actor.jpg and ACTOR.JPG are two different files)?
Are the images a resource? (Also look here.)
Try doing step-by-step what is described here (NetBeans documentation).

Related

How to structure image paths in ascidoctor?

I have a book with the following directory structure
book.adoc
chapters/chapter1.adoc
chapters/chapter2.adoc
chapters/chapter3.adoc
images/img1.jpg
images/img2.jpg
in book.adoc I include the chapters. The problem is that in each chapter I include images from the images directory. If I use a path relative to book.adoc then the images render when I generate the PDF of the entire book, but not when I generate a PDF of an individual chapter.
This is particularly annoying when working on a chapter and the HTML preview does not show the images.
Is there a way to specify the paths so it works in both cases? Is the only way to move the chapters up a directory?
Yes. Your documents can specify the imagesdir attribute. See the documentation.
If you specify imagesdir as a relative path, such as ./images, then you can have chapter-specific image folders that should allow your full and chapter-specific builds to work, as well as make the HTML preview work.

Vue markdown Image not displaying

I'm using the vue-markdown package to render markdown. It seems to work except the images don't display. The file path is correct as I can have an img show up correctly
<img src="#/assets/7801_4_lang_image.png"><!-- shows up -->
<vue-markdown>![img](#/assets/7801_4_lang_image.PNG)</vue-markdown><!-- doesn't show up -->
Changing the # to .. doesn't change anything either, the top one displays but the bottom one doesn't. The case of png/PNG also doesn't matter. Am I referencing the image wrong?
The file loader doesn't know about images in Markdown so Webpack doesn't know to bundle them.
Typically you need to require() the image source (see https://cli.vuejs.org/guide/html-and-static-assets.html#relative-path-imports)
You could try this but I'm not entirely sure if it will work with the vue-markdown component.
![img]({{ require('#/assets/7801_4_lang_image.PNG') }})
To use the source prop, you would use something like
<vue-markdown :source="`![img](${require('#/assets/7801_4_lang_image.PNG')})`">
See https://v2.vuejs.org/v2/guide/syntax.html#Attributes
You could also use the public folder who's contents are always bundled. For example, for a file public/images/7801_4_lang_image.PNG and assuming your app runs at the domain root
![img](/images/7801_4_lang_image.PNG)

UWP: Retrieve correct file name/path from scale-based asset

Currently I retrieve the file path from XAML in this way:
var myFile = System.IO.Path.Combine(Package.Current.InstalledLocation.Path, fileImage.File);
Because in XAML the file name is e.g. icon.png and not icon.scale-150.png it doesn't find the image, when I want to read it into a stream. How can I retrieve the correct file name/path from the scale-based asset?
It has to take the general path and convert it into a scale-based path. Is there a method for this? I can't find one.
If the icon.png is located in the Assets folder, you can just retrieve the URI by using the ms-appx protocol, in this way:
var file = new Uri("ms-appx:///Assets/icon.png");
This will retrieve the icon with the right scale, based on the device.

Magmi is cannot find multiple images

I've Googled, and Stackoverflowed this to death (and checked the Wiki), but I can't find a solution to my problem :(
Problem:
With Magento Magmi: all products and single images are importing fine, the only catch is that Magmi throws the following error when I try to import multiple images (e.g. /BJ977L.png,/BJ977R.png):
Image attributes processor v1.0.25 - /BJ977L.png,/BJ977R.png cannot be found in images path
Obviously I checked and the files are there... Also, if I change it to only reference one image, then it works. I find this very confusing.
The images are located in: media/import and the Magmi Image Plugin configuration reflects this. Also, if I move the images to another folder, say var/import/images; then it makes no difference...
Your help is hugely appreciated!
Thanks in advance!
As the Images Attribute Processor documentation states, you should be using a semi-colon ; to separate multiple images.
/extraimg1.jpg;/extraimg2.jpg
Also ensure that the column names you are using are correct. media_gallery is the correct column header name for the media gallery images.
Have you tried using semi colon?
/BJ977L.png;/BJ977R.png
Have you tried using the complete file path to the images? Also, did you specify the file path root for the images in the plugin settings?
If you have formatted the .csv file the right way then you should check the Image Renaming setting for the Image attributes processor. If you specify a bad rule to rename your newly imported images you could end up with the same name for every picture. So basically the first image will be imported, then the second will overwrite it because it was given the same name. If you only see the last picture you specified for the media_gallery attribute then this is probably the cause.
Hope this helps.

How to change source of image in magento

Please tell me how to change the image source in magento dynamically.say I want that after every 10 seconds I want to change the source of image.
now I have define a static block which contain image src with id banner..
now my question is where should I define for changing the image source and how to change the source.
I would suggest looking into a jQuery based image rotator. There are some simple examples out there such as this one:
http://burnmind.com/tutorials/how-to-create-a-simple-automatic-image-rotator-using-jquery
Also be careful not to cause conflicts with jQuery and Prototype. You can use this method to avoid this from happening.
Refer to these links: They are free extensions which may serve your purpose.
http://expertmagentodevelopers.wordpress.com/2012/04/24/download-magento-banner-slider-extensions-free/
http://www.magentocommerce.com/magento-connect/banner-slider-3912.html
http://www.magentocommerce.com/magento-connect/Interakting.com/extension/2255/interakting-slider#overview

Resources