Free Support Forum - aspose.cloud

How to Replace/Insert an image on a PowerPoint Presentation Slide in PHP with Aspose.Slides REST API

How do I replace or insert on image on a slide? I can see various API calls for getting images and manipulating shapes, but nothing for replacing or inserting an image on a slide.

My use case here is to insert a client logo on a presentation.

Am I missing something?

@klubar,

Thanks for your inquiry. Yes Image API does not support to add image on a slide. However, you can use the shapes API with PictureFrame shape type and image data passed as Base64 for the purpose. Please check following the cURL command. Hopefully it will help you to accomplish the task.

POST https://api.aspose.cloud/v3.0/slides/myPresentation.pptx/slides/1/shapes

curl -X POST "https://api.aspose.cloud/v3.0/slides/ShapeInSlide.pptx/slides/1/shapes" 
-H "accept: application/json" 
-H "authorization: Bearer [JWT_Access_Token]" 
-H "Content-Type: application/json" 
-d {  "Type": "PictureFrame",
  "PictureFillFormat": {
    "Type": "Picture",
    "Base64Data": "xxxxxx",
    "PictureFillMode": "Stretch"
  },
  "GeometryShapeType": "Rectangle",
  "Width": 300.0,
  "Height": 200.0,
  "X": 10.0,
  "Y": 10.0
}