Convert Image to PPTX in PHP
Place an image on a presentation slide and save the result as a PowerPoint PPTX file with Aspose.Slides for PHP via Java.
Convert Image to PPTX using PHP
To convert an image to PPTX, create a Presentation, add the image with addPictureFrame, and call save with SaveFormat::Pptx.
PHP code for converting Image into PPTX
$presentation = new Presentation();
try {
$slide = $presentation->getSlides()->get_Item(0);
$sourceImage = Images::fromFile("input.png");
try {
$embeddedImage = $presentation->getImages()->addImage($sourceImage);
} finally {
$sourceImage->dispose();
}
$imageWidth = java_values($embeddedImage->getWidth());
$imageHeight = java_values($embeddedImage->getHeight());
$slide->getShapes()->addPictureFrame(
ShapeType::Rectangle, 0, 0, $imageWidth, $imageHeight, $embeddedImage);
$presentation->save("output.pptx", SaveFormat::Pptx);
} finally {
$presentation->dispose();
}Convert Image to PPTX in PHP
Aspose.Slides for PHP via Java lets you place an image on a presentation slide at its original dimensions and save the result as a PowerPoint Open XML file.
Aspose.Slides supports common raster and vector image formats and can save image-based slides as PPTX, PPT, PDF, HTML, and other supported formats.
How to convert Image to PPTX using Aspose.Slides for PHP API
These are the steps to convert Image to PPTX in PHP.
- Install Aspose.Slides for PHP via Java.
- Configure Aspose.Slides in your PHP project.
- Load the source image with
Images::fromFileand add it to the presentation image collection. - Add the image to the slide with
addPictureFrame, then save withSaveFormat::Pptx.
Built with Aspose.Slides
Convert Image to PPTX Online
The free Aspose.Slides Conversion app is built with Aspose.Slides for PHP via Java, the same API as the code above. Open it and see what the API can do with your own Image files.
- Runs in your browser, nothing to install.
- See how Aspose.Slides converts files before you write code.
- Upload Image files and save them as PPTX.
- Download the result or convert more files.
Convert Image To Other Supported Formats
You can also convert Image and save to other file formats. See all supported formats below: