C# VisualWebpart get Images from a specific Image Library.

Hello,
I'm working on a VisualWebpart Project in VS2013.
Are there any possibilities, where I can get the Images from a Image Library?
Like this:
//pseudocodeSPLibrary imagesLib = new SPLibrary("mySite\Library")
var imageList = imagesLib.GetContent(".jpg")
Thank you.

SPList LstPicture = web.Lists["yourlist"];
List<ImageCollection> lsts = new List<ImageCollection>();
foreach (SPListItem item in LstPicture.Items)
string ImageUrl = Convert.ToString(item["Thumbnail URL"]);
string ImageName = Convert.ToString(item["Name"]);
lsts.Add(new ImageCollection(ImageUrl, ImageName));
or
SPWeb thisWeb =
SPContext.Current.Web;
SPPictureLibrary pictures
= (SPPictureLibrary)thisWeb.Lists["Houston
Photos"];
int pictureCount = pictures.ItemCount;
int index = randomNumber.Next(pictureCount);
string source = thisWeb.Url
+ "/"
+ pictures.Items[index].Url;
var image =
new Image();
image.ImageUrl
= source;
image.Height
= 200;
this.Controls.Add(image);
or
SPPictureLibrary chartPictureLibrary = (SPPictureLibrary)web.Lists["UrPictureLibraryName"];
SPQuery query = new
SPQuery();
                        query.Query =
@"<Where><Eq><FieldRef Name ='Title'/><Value Type='Text'>" + fileName +
"</Value></Eq></Where>";
SPListItemCollection lstImages = chartPictureLibrary.GetItems(query);

Similar Messages

  • Hide the delete menu item from a specific document library

    I want to hide the Delete  item menu option for a specific document library.Since it is for a specific library I would not like to use customcore.js approach.Please suggest some useful javascript for same.
    I have a custom delete action associated with the menu which performs other function as well so need to hide the OOB delete option from the item  menu of a document library.
    I have already used below javascript in CEWP which I added on the document library page itself(allitems.aspx) but yeild no results:
    <script type="text/javascript">
    var elemTable=document.getElementById('ECBItems');
    if (elemTable !=null) {
         var elemTBody=elemTable.childNodes[0];
    //iterate each table row to find the correct ECB menu item to hide(remove)
       for (var iMenuItem=0; iMenuItem < elemTBody.childNodes.length; iMenuItem++) {
             var elemTR=elemTBody.childNodes[iMenuItem];
             var elemTDTitle=elemTR.childNodes[0];
             var title=GetInnerText(elemTDTitle);
     //here we filter on title, but the table contains more information if need be
            if(title =='Delete') {
                 elemTBody.removeChild(elemTR);
    </script>
    Please suggest which can be kept specific and requires no change in masterpage as same masterpage is used across the site.

    Hi justSP,
    Greetings.
    Hope the below links help you
    http://social.technet.microsoft.com/Forums/office/en-US/9adea3a2-6d08-4c04-ace2-88a704833f1d/how-to-hide-delete-item-from-ecb-menu-for-1-specific-custom-list?forum=sharepointcustomizationlegacy
    http://chakkaradeep.com/index.php/sharepoint-hiding-menu-items-from-the-edit-control-block/
    http://social.technet.microsoft.com/Forums/office/en-US/1b832635-4ae7-4f31-826c-2d6b834ece52/hide-delete-from-ecb-menu-for-a-specific-document-library-in-sharepoint-2010?forum=sharepointcustomizationprevious
    http://social.technet.microsoft.com/Forums/office/en-US/919e01e6-9a7a-4439-b778-28e0dc8bffba/how-to-hide-delete-option-from-ecb-menu-in-document-library-in-sharepoint-2010?forum=sharepointdevelopmentprevious
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • Show custom EditForm from a specific document library view

    Hello,
    I've created a custom EditForm that I would like to show when the user clicks the "<label for="ShouldDisplayEdit">Edit" (link to edit item)</label> icon; however I just want to show this EditForm for a specific view.
    I have a listview webpart (actually an "app") for the library and this specific view set on a page. However, it opens the default edit form instead of the custom one. (StatusEdit.aspx). I don't want to set StatusEdit.aspx as the default, as it
    has fewer fields than the default edit form.
    I am able to hide fields conditionally using SPClientTemplates.TemplateManager.RegisterTemplateOverrides, but it's been a lot of work to try to make it match the requirements I have. I'd really like to have the custom edit form work if it's possible.
    Thank you for your help!
    Best Regards,
    Kevin Worthington

    Hi,
    According to your description, my understanding is that you want to specify the custom EditForm for a specific document library view.
    We can change the link to edit item button url using Jquery to achieve it.
    Here is a code snippet for your reference:
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    function changeurl()
    $(' ms-itmHoverEnabled ms-itmhover ms-droppable).find('ms-vb-lastCell ms-cellstyle ms-vb-icon ms-vb-lastCell').attr(‘href’,”http://new url”);
    </script>
    Here are some detailed articles for your reference:
    http://stackoverflow.com/questions/179713/how-to-change-the-href-for-a-hyperlink-using-jquery
    http://stackoverflow.com/questions/8729830/jquery-find-td-of-tr-with-class-and-make-changes-for-a-telerik-mvc-grid
    Thanks
    Best Regards
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jerry Guo
    TechNet Community Support

  • Getting values from a specific row in a table

    hi all, i have a table that has the following data
    WITH sec AS
      SELECT 111 id,  'XPE' cid,  10 alias, 'TLC' Description, 'PEYU' lvl_1, 'IES' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
      SELECT 111 id,  'XPE' cid,  78 alias, 'TLC2' Description, 'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
       SELECT 111 id,  'XPE' cid,  200 alias, 'TLC' Description, null lvl_1, null lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
      SELECT 111 id,  'XPE' cid,  54 alias, 'TLC3' Description, 'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
      SELECT 112 id,  'XPE2' cid,  10 alias, 'PAD' Description, 'PEYU' lvl_1, 'IES' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
      SELECT 112 id,  'XPE2' cid,  78 alias, 'PAD2' Description, 'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
      SELECT 112 id,  'XPE2' cid,  54 alias, 'TLC3' Description, 'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
      SELECT 112 id,  'XPE2' cid,  200 alias, 'PAD' Description, 'SIN' lvl_1, 'CON' lvl_2, ' UIE' lvl_3 FROM dual UNION ALL
      SELECT 113 id,  'XPE3' cid,  10 alias, 'PAD5' Description, NULL lvl_1, NULL lvl_2, NULL lvl_3 FROM dual UNION ALL
      SELECT 113 id,  'XPE3' cid,  200 alias, 'PAD5' Description, NULL lvl_1, NULL lvl_2,  NULL lvl_3 FROM dual UNION ALL
      SELECT 113 id,  'XPE3' cid,  78 alias, 'PAD7' Description, 'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
      SELECT 113 id,  'XPE3' cid,  54 alias, 'TLE' Description, 'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual
    )i want to write a query that give me this output
    ID     CID     ALIAS     DESCRIPTION     LVL_1     LVL_2     LVL_3
    111     XPE       10     TLC             PEYU     IES       BAN
    111     XPE       200     TLC             PEYU    IES      BAN
    111     XPE       78     TLC2             SUN              BAN3
    111     XPE       54     TLC3             SUN5              BAN3
    112     XPE2     10     PAD             PEYU     IES       BAN
    112     XPE2     200     PAD             SIN     CON       UIE
    112     XPE2     78     PAD2             SUN                BAN3
    112     XPE2     54     TLC3             SUN5              BAN3
    113     XPE3     10     PAD5               
    113     XPE3     200     PAD5               
    113     XPE3     78     PAD7             SUN              BAN3
    113     XPE3     54     TLE             SUN5              BAN3
    this is how the logic works:
    as you can see the table has many different set of ids, 111,112,113 and each id has a set of alias
    for id 111 and alias 200 the sec table has null values for level 1 and level 2 columns. what i want to do
    is that if any of the level1,level2 and level3 columns has null VALUES(FOR aliases=200) then the values should be taking from the ROW(s) with alias=10
    in this case alias=200 display peyu and ies for level1 and level2 column. this values were taking from the row with alias=10 and id =111.
    level3 stay the same since it is not null
    for id 112 and alias =200, none of te level columns has null so the value stay the same as in the table
    for id 113 alias 200, all level columns has null so the value should be taking from alias=10 id =113.
    in this case the row with alias=10 has also null so both rows 200 and 10 gets display with null values
    the other rows with different alias should just be display.
    i tried using las_value analytic function but i was not successful. i am using ORACLE 9I and ignore null option in last_value function is not supported
    the data in the table is not in any particular order.
    can someone help write a query that gives me the output above. thanks

    If I understand correct,below solution is corect. :-)
    col lvl_2 for a10
    WITH sec AS(
    SELECT 111 id, 10 alias,'PEYU' lvl_1, 'IES' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
    SELECT 111 id, 78 alias,'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
    SELECT 111 id,200 alias,null lvl_1, null lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
    SELECT 111 id, 54 alias,'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
    SELECT 112 id, 10 alias,'PEYU' lvl_1, 'IES' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
    SELECT 112 id, 78 alias,'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
    SELECT 112 id, 54 alias,'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
    SELECT 112 id,200 alias,'SIN' lvl_1, 'CON' lvl_2, ' UIE' lvl_3 FROM dual UNION ALL
    SELECT 113 id, 10 alias, NULL lvl_1, NULL lvl_2, NULL lvl_3 FROM dual UNION ALL
    SELECT 113 id,200 alias, NULL lvl_1, NULL lvl_2,  NULL lvl_3 FROM dual UNION ALL
    SELECT 113 id, 78 alias,'SUN' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual UNION ALL
    SELECT 113 id, 54 alias,'SUN5' lvl_1, null lvl_2, ' BAN3' lvl_3 FROM dual
    select id,alias,
    case when alias = 200 and lvl_1 is null
         then max(decode(alias,10,lvl_1)) over(partition by id)
         else lvl_1 end as lvl_1,
    case when alias = 200 and lvl_2 is null
         then max(decode(alias,10,lvl_2)) over(partition by id)
         else lvl_2 end as lvl_2,
    case when alias = 200 and lvl_3 is null
         then max(decode(alias,10,lvl_3)) over(partition by id)
         else lvl_3 end as lvl_3
      from sec
    order by id,alias;
    ID  ALIAS  LVL_  LVL_2  LVL_3
    111     10  PEYU  IES     BAN
    111     54  SUN5  null    BAN3
    111     78  SUN   null    BAN3
    111    200  PEYU  IES     BAN
    112     10  PEYU  IES     BAN
    112     54  SUN5  null    BAN3
    112     78  SUN   null    BAN3
    112    200  SIN   CON     UIE
    113     10  null  null   null
    113     54  SUN5  null    BAN3
    113     78  SUN   null    BAN3
    113    200  null  null   null

  • Get data from a specific month?

    I have this code:
    <h1><cfoutput>#self#</cfoutput></h1>
    <cfquery datasource="Intranet" name="month_data">
      select * from CSEReduxResponses where status=1 and execoffice_status=0
       AND MONTH([approveddate]) = MONTH(GETDATE())
       </cfquery>
    <cfquery datasource ="Intranet" name="GetDeptSubmissions">SELECT * FROM CSEReduxResponses</cfquery>
    <cfquery dbtype="query" name="GetApproved">SELECT * FROM GetDeptSubmissions WHERE status = 1 AND execoffice_status = 1</cfquery>
    <cfquery dbtype="query" name="GetDenied">SELECT * FROM GetDeptSubmissions WHERE status = 1 AND execoffice_status = 2</cfquery>
    <cfif month_data.RecordCount gt 0>
    <cfoutput>
              <h2>Comments / Ratings Administration</h2>
              <div>
                        <div class="display_count pending_outer">
                                  <div class="display_count_desc pending_inner">Pending</div>
                                  <cfif month_data.RecordCount gt 0><a href="cse_execoffice_pending.cfm"></cfif>
                                            <span class="display_count_number">#month_data.RecordCount#</span>
                                  <cfif month_data.RecordCount gt 0></a></cfif>
                        </div><!--- /div class="display_count" --->
                        <div class="display_count approved_outer">
                                  <div class="display_count_desc approved_inner">Approved *</div>
                                  <cfif GetApproved.RecordCount gt 0><a href="cse_execoffice.cfm?approved"></cfif>
                                            <span class="display_count_number">#GetApproved.RecordCount#</span><br>
                                  <cfif GetApproved.RecordCount gt 0></a></cfif>
                        </div><!--- /div class="display_count" --->
                        <div class="display_count denied_outer">
                                  <div class="display_count_desc denied_inner">Denied</div>
                                  <cfif GetDenied.RecordCount gt 0><a href="cse_execoffice.cfm?denied"></cfif>
                                            <span class="display_count_number">#GetDenied.RecordCount#</span><br>
                                  <cfif GetDenied.RecordCount gt 0></a></cfif>
                        </div><!--- /div class="display_count" --->
              </div>
    </cfoutput>
    </cfif>
    Right now it display the the output if the 'month_data.recordcount gt 0' , but this would be for all the
    data from the current month because of the query 'month_data'
    What I want to do display_count for each month.
    for example right now it display the data from April, but once its May I would like to display another
    'display_count' from the month of March, even if the other Pending from April still has not hit zero(0).
    any help/advice will help, not sure if there is a better way to do this.
    this is a example of what i have right now, this has 3 peding in the month of April

    Carl Von Stetten wrote:
    It looks like you've posted this same or related question twice on StackOverflow (http://stackoverflow.com/questions/22970021/how-can-i-show-a-output-fr om-a-specific-date and http://stackoverflow.com/questions/23092245/how-to-output-different-da ta-from-different-months).  If you're going to cross-post to multiple forums, then mention that and provide links to your posts on other forums so people can see what others are suggesting and not duplicate efforts.
    Plus http://forums.adobe.com/message/6295752#6295752
    @No_name_123
    As I suggested elsewhere, I hope you will spend more time doing the code than explaining your requirements for fellow developers to do the code for you. I would avoid saying things like these:
    ... What I want to do display_count for each month....
    ... I would like to display another 'display_count' from the month of March...
    Instead, I would write some code, or even pseudocode, and then ask for suggestions on it.
    Message was edited by: BKBK

  • How to get pics from iphone to iphoto library on hard drive

    Hi there. I saved my photo library to an EHD. I pointed iphoto to open the library from EHD. Normally when I connect my iphone to my macbook pro, iphoto just pops up asking to import the pics from my phone. But now it doesn't do that and it doesn't show my phone on the left pane of i photo. How do I get my pics and videos from my iphone into the iphoto library i saved on my ehd? Thanks!

    Greetings,
    Make sure your external hard drive is Mac formated and has a reasonable amount of space available.
    --- Side note:  If you haven't already, you should tell TimeMachine to backup that external hard drive as Time Machine only backs up your internal hard drive by default.
    Try:
    1. Install all software updates for both your computer and your iPhone and turn both on and off and re-plug the cable between them.
    2. Try importing your pictures and movies using Image Capture found in Macintosh HD > Applications.
    -- If Image Capture sees your iPhone when iPhoto does not, try creating a new iPhoto library on your internal drive to see if that library can see your iPhone.  This is done by launching iPhoto while holding down the option key.
    If those steps do not help, follow this article: http://support.apple.com/kb/TS3195
    Cheers.

  • Any way to get music from ipod back into library after hard drive crash?

    I just survived and am recovering from a hard drive crash. For some reason, on my backup, I only retained about 500 of my 2500 songs in my library. All of my music is intact on the ipod however. Is there any way at all to resolve this issue and get the music from the ipod into the libary, or in the alternative, any way to back up the stuff on the ipod? Thanks.

    Connect your iPod to your computer. If it is set to update automatically you'll get a message that it is linked to a different library and asking if you want to link to this one and replace all your songs etc, press "Cancel". Pressing "Erase and Sync" will irretrievably remove all the songs from your iPod. When your iPod appears in the iTunes source list change the update setting to manual, that will let you use our iPod without the risk of accidentally erasing it. Check the "manually manage music and videos" box in Summary then press the Apply button. Also when using most of the utilities listed below your iPod needs to be enabled for disc use, changing to manual update will do this by default: Managing content manually on iPod and iPhone
    Once you are safely connected there are a few things you can do to restore your iTunes from the iPod. If you have any iTunes Music Store purchases the transfer of purchased content from the iPod to authorised computers was introduced with iTunes 7. You'll find details in this article: Copying iTunes Store purchases from your iPod or iPhone to a computer
    The transfer of content from sources such as songs imported from CD is designed by default to be one way from iTunes to iPod. However there are a number of third party utilities that you can use to retrieve the music files and playlists from your iPod. You'll find that they have varying degrees of functionality and some will transfer movies, videos, photos, podcasts and games as well. Have a look at the web pages and documentation, this is just a small selection of what's available, they are generally quite straightforward. You can read reviews and comparisons of some of them here:
    Wired News - Rescue Your Stranded Tunes
    Comparison of iPod managers
    TuneJack Windows Only (iPhone and iPod Touch compatible)
    iPod2PC Windows Only
    iDump Windows Only
    SharePod Windows Only
    iPodRip Mac & Windows
    YamiPod Mac and Windows
    Music Rescue Mac & Windows
    Floola Mac & Windows
    iGadget Mac & Windows (iPhone and iPod Touch compatible)
    iRepo Mac & Windows (iPhone and iPod Touch compatible)
    iPod Access Mac & Windows (iPhone and iPod Touch compatible)
    TouchCopy Mac & Windows (iPhone and iPod Touch compatible - Windows version only)
    There's also a manual method of copying songs from your iPod to a Mac or PC. The procedure is a bit involved and won't recover playlists but if you're interested it's available on page 2 at this link: Copying Content from your iPod to your Computer - The Definitive Guide
    Whichever of these retrieval methods you choose, keep your iPod in manual mode until you have reloaded your iTunes and you are happy with your playlists etc then it will be safe to return it auto-sync. I would also advise that you get yourself an external hard drive and back your stuff up, relying on an iPod as your sole backup is not a good idea and external drives are comparatively inexpensive these days, you can get loads of storage for a reasonable outlay.

  • How to get music from iphone into itunes library, that was not purchased via itunes??

    Hard drive crashed, I restored my itunes music from a backup, but the backup was not updated, I'm missing music that I have on my iphone playlist, this music I got from a friend, I didn't buy it from itunes. Question: How can I get this musica from the iphone into my itunes library???
    Thank's for the help!!!

    The music sync is one way - computer to iphone.  The only exception is itunes purchases.
    You may be able to purchase a third party program ( not supported by Apple).

  • Get songs from i phone to library

    I would like to get song on my iphone to my library on my mac pro. I saw a post about songs purchased from itunes but what about songs that were not purchase from itunes? Is there a way to get them into my library?

    For content not purchased from the iTunes Store, check out this post from Zevoneer for some iPod/iPhone media recovery options:
    http://discussions.apple.com/thread.jspa?messageID=10570955#10570955
    Regards.

  • Sound for messages from a specific email address

    I get a couple of hundred email messages a day. I have Mail checking every five minutes for messages. I obviously don't want Mail to bong me every five minutes that it's got new messages, but I would really like if it could make a sound when I get mail from a specific email address. Is this possible?
    Thanks.
    All the best,
    Tom

    You may be able to do what you want through "Rules" which is in Mail/Preferences/Rules. Click on the _"Add Rules"_ button. From that window, you will be able to select specific email addresses that you want to add a specific sound to *(Perform the following actions)*.
    Under the General tab, I gather you need to have "New Messages Sound" set to "None."
    *"Play sounds for other mail actions"* should be checked.

  • How to get images dynamically from database without file paths in the table field

    I have a MS-Access database. I am working with ASP.NET. In the database there is product table in which I have "CodeNo" as a field which is a text field, and the product codes like "SM-R-2035". I also have another field "Image" which is also a text field and which have a file path in it corresponding to the particular product Image (e.g. Images\Products\SM-R-2035.jpg). So far every thing is ok. I have to update this site very frequently and lots of images are added each and every time. Its a tedious work to type the paths and file name every time and it also take a lot of time.
    What I am asking is : Is it possible to get images from a specific folder at runtime which is referenced by the "code no" itself and not the file path from the database. (Say at run time the "code no" is referenced from the database and the corresponding image is loaded dynamically from the specified folder). In other word I want to avoid the tedious work of typing.
    Can any one help with this issue. Any other simple suggestions are welcome.

    All you need to do is simple concatenation to obtain the path for the image file.  You didn't mention whether you are using VB.Net, C# or some other language to do your coding.
    If the code in your database is SM-R-2035, the file name is SM-R-2035.jpg and the path to the images foilder is Images\Products\SM-R-2035.jpg, Conceptually here is what you need to do:
    dim code_var
    dim path_var
    code_var = the code you obtain from your relevant field in the database
    path_var = "Images\Products\" & code_var & ".jpg"
    Now path_var is what you would call to obtain the image from your images folder.

  • Getting images from camera

    I have Elements 4.  I am unable to transfer images from either of my cameras to the site.  When i attach either to the computer and it says "select a device' it does not give me an opportunity to put in the name of the camera and so i cannot put images directly onto Photoshop. What's wrong?

    I don't think that camera card slots on the printers work with Photoshop Elements.
    1 -- I use a USB port connected device that is specifically a card reader for camera cards. Sandisk is one manufacturer of these readers. Here is a link for info on their site
    http://www.sandisk.com/products/readers-accessories
    You do need to be sure that the reader you choose accepts exactly your type and capacity of camera card.  For example if you have an SDHC format card, be aware that there are some older reader models that can read the SD format but not the SDHC forrmat.
    2 -- I expect that Windows Explorer may be able to read your camera card in its slot on the printer. So if your printer card slot shows in Windows Explorer, you could try using Windows Explorer to COPY your photo files to your PC hard drive and then do a PSE 4 Get Photos from Files and Folder to enter those photo files in the Organizer.
    Personally I favor using the camera rather than computer software to delete photo files from the card. And in this case, I would definitely NOT delete the photos from the camera card until I was totally sure of the transfer to the PC.

  • Get color from image

    Hey people, I'm new to Illustrator and have a question. I want to use a color from an image that I put into Illustrator.
    The exact things I did with the image are the following: copied it from Windows Photo Viewer into Illustrator, then put the 'cut out' effect on it, then copied it into a new Illustrator document that has a businesscard template and resized it fit the template's margins. Now I want to kind of 'enlengthen' the image by putting a square next to it. To make it look smooth, it has to have the same color as that side of the image of course. But that's my problem, I'm not able to select the color from the image and make a new color group with that specific color. The 'get color from selected artwork' button doensn't help much since I can't click it, for some reason the mouse turns into this 'can't click here' icon every time I move it on this button.
    Any help would be greatly appreciated!
    PS apologies for any unavoidable noobness

    To sample a color from a raster image, ShiftClick with the Eyedropper tool. (CS3)
    Always state what software version you are using.
    JET

  • Rich text box used in Infopath Form not displaying option to get images from Computer

    Hello,
    We have used "Rich text box" in Infopath Form which is not displaying option to get images from Computer.
    Options available are : From Address, From SharePoint
    But if we Rich text box in list, then it works fine with "From Computer" option.
    can you please help me out to get this option.
    Thanks in advance.
    REgards,
    Jayashri

    Hi,
    From your description, there is no “From Computer” option to get images with rich text box in InfoPath form.
    Per my knowledge, by design there are “From Address” and “From SharePoint” options without “From Computer” option in rich text box in InfoPath form. As a workaround, you can develop a custom InfoPath Rich Text box to do it.
    About developing a custom InfoPath control, I suggest you create a new thread on the forum “Visual Studio Tools for Office”, more experts will assist you with InfoPath development.
    Visual Studio Tools for Office:
    https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=vsto&filter=alltypes&sort=lastpostdesc
    Thanks,
    Dean Wang

  • Get Images from jar. getResource() not working

    I've read some of the posts in the forum and I've tried the solutions but still cant get the images in my program.
    I'll write all the things I've tried (All of them works fine when I run them from bluej):
    1- The code used in the jar files in demo folder of jdk:
    /** Inside the main class: */
    private static ResourceBundle resources;  
        static {
            try {
                resources = ResourceBundle.getBundle("resources.Recursos", Locale.getDefault());
            } catch (MissingResourceException mre) {
                JOptionPane.showMessageDialog(new JFrame(), "ResourceBundle not found","Error",JOptionPane.ERROR_MESSAGE);
                System.exit(1);
    public String getResourceString(String nm)
            String str;
            try {       
                str = resources.getString(nm);   
                  } catch (MissingResourceException mre) {       
                str = null;
            return str;
        public URL getResource(String key)
            String name = getResourceString(key);
            if (name != null)
                URL url = getClass().getResource(name); //  Here is the exception
                return url;  
            return null;
        public ImageIcon loadImage(String image_name)
            URL image_url = null;    
            try
                image_url = getResource(image_name);             
                if (image_url != null)
                    return new ImageIcon(image_url);
                else
                return null;                  
            }catch(Exception e)
                JOptionPane.showMessageDialog(new JFrame(), e.getMessage() + "In load Image","Error",JOptionPane.ERROR_MESSAGE);
                return null;
    /** Inside the constructor */
    abrirButton = new JButton(loadImage("open"));
    }//End of the class}
    The ResourceBundle is a file named: Recursos.properties and it's in a folder inside the folder of my *.class and *.java And have this information:
    Title=Recursos
    ElementTreeFrameTitle=Elements
    ViewportBackingStore=false
    open=resources/open24.gif
    save=resources/saveAs24.gif
    cut=resources/cut24.gif
    copy=resources/copy24.gif
    paste=resources/paste24.gif
    analisis=resources/bean24.gif
    This one, runs with the jar, but the images are not in the buttons and I get the Dialog message telling me that there was an error in loadImage. Check that method. I used this dialogs to track the error and the exception it's generated by:
    URL url = getClass().getResource(name);
    in public URL getResource(String key) method.
    2- I also tried to follow the instructions of this article that describes how to get resources from jars:
    http://www.javaworld.com/javaworld/jw-07-1998/jw-07-jar-p2.html
    This is the first page of the article:
    http://www.javaworld.com/javaworld/jw-07-1998/jw-07-jar.html
    And I did something like this:
    /** Inside constructor */
    abrirButton = new JButton(new ImageIcon(getImageFromJAR("Imagenes/open24.gif")));
    /** Inside of my main class */
    public Image getImageFromJAR(String fileName)
               try{
               if( fileName == null ) return null;          
               Image image = null;
               Toolkit toolkit = Toolkit.getDefaultToolkit();          
                image = toolkit.getImage( getClass().getResource(fileName) );           
                return image;
                }catch(Exception exc){
                    JOptionPane.showMessageDialog(new JFrame(), "Exception loading the image","Error",JOptionPane.ERROR_MESSAGE);
                    return null;
    ...The images in this one are in the folder Imagenes inside the folder of my *.class and *.java
    This one work fine in bluej too, but the jar... It doesn't even start.
    3- And the last one.
    abrirButton = new JButton(new ImageIcon(getClass().getResource("Imagenes/open24.gif"));Works fine in bluej, not running in jar.
    Am I doing something wrong? Please somebody help me.
    thanks in advance

    Are you putting the image files inside the jar? If you are, then use "jar tf jarfile.jar" to display the contents of the jar and make sure the files are there and inside the right directory. If you are not, then you can not use getClass().getResource() from a jar file because it will look inside the jar file.
    If you are getting an error message, please post it.

Maybe you are looking for