title: Inserting image in PPTX using OpenXML does not work
body: <p>I am trying to generate a PowerPoint file containing a image using OpenXML. Unfortunately it does not work. The image is not being displayed. I've checked the file generated with the OpenXML productivity tool and I respectively unzipped the file contents. The file itself contains the image in /ppt/media/image.png and it should be displayed in the second slide.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>private void InsertSlide(string chartString, int position, string title, string text = "")
  {
      if (m_presentation == null || title == null || m_presentation.PresentationPart == null)
          return;
  
      var slide = new Slide(new CommonSlideData(new ShapeTree()));
      var nonVisualProperties =
         slide.CommonSlideData.ShapeTree.AppendChild(new NonVisualGroupShapeProperties());
         nonVisualProperties.NonVisualDrawingProperties = new NonVisualDrawingProperties { Id = 1, Name = "" };
         nonVisualProperties.NonVisualGroupShapeDrawingProperties = new NonVisualGroupShapeDrawingProperties();
         nonVisualProperties.ApplicationNonVisualDrawingProperties = new ApplicationNonVisualDrawingProperties();
         slide.CommonSlideData.ShapeTree.AppendChild(new GroupShapeProperties());
  
  
      var slidePart = m_presentation.PresentationPart.AddNewPart&lt;SlidePart&gt;();
      var imagePart = slidePart.AddImagePart(ImagePartType.Png, "irgendeinscheiss");   
  
      //var imageStream = new MemoryStream(Convert.FromBase64String(chartString));
      using (var imageStream = new FileStream(@"C:\Users\DA\Desktop\Charts\1_Chart2_01.png", FileMode.Open))
      {
           imageStream.Position = 0;
           imagePart.FeedData(imageStream);
      }
  
      slide.Save(slidePart);
  
      var slideIdList = m_presentation.PresentationPart.Presentation.SlideIdList;
      uint maxSlideId = 1;
      SlideId prevSlideId = null;
      foreach (SlideId slideId in slideIdList.ChildElements)
      {
          if (slideId.Id &gt; maxSlideId)
              maxSlideId = slideId.Id;
          position--;
  
          if (position == 0)
              prevSlideId = slideId;
      }
  
      maxSlideId++;
      SlidePart lastSlidePart;
  
      if (prevSlideId != null)
            lastSlidePart = (SlidePart)m_presentation.PresentationPart.GetPartById(prevSlideId.RelationshipId);
      else
            lastSlidePart = (SlidePart)m_presentation.PresentationPart.GetPartById(((SlideId)(slideIdList.ChildElements[0])).RelationshipId);
  
      if (lastSlidePart.SlideLayoutPart != null)
           slidePart.AddPart(lastSlidePart.SlideLayoutPart);
  
      var newSlideId = slideIdList.InsertAfter(new SlideId(), prevSlideId);
      newSlideId.Id = maxSlideId;
      newSlideId.RelationshipId = m_presentation.PresentationPart.GetIdOfPart(slidePart);
      m_presentation.PresentationPart.Presentation.Save();
  }
  </code></pre>
  
  <p>Am I missing something? Maybe the relationships? After looking up 232243 thousand different examples, I am still stuck at this point. Thank you!</p>