Convert Image to PPT in PHP

Place an image on a presentation slide and save the result as a PowerPoint PPT file with Aspose.Slides for PHP via Java.

Convert Image to PPT 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 97–2003 PPT file.

Aspose.Slides supports common raster and vector image formats and can save image-based slides as PPT, PPTX, PDF, HTML, and other supported formats.

Convert Image to PPT using PHP

To convert an image to PPT, create a Presentation, add the image with addPictureFrame, and call save with SaveFormat::Ppt.

PHP code for converting Image into PPT

$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.ppt", SaveFormat::Ppt);
} finally {
    $presentation->dispose();
}

How to convert Image to PPT using Aspose.Slides for PHP API

These are the steps to convert Image to PPT in PHP.

  1. Install Aspose.Slides for PHP via Java .

  2. Configure Aspose.Slides in your PHP project.

  3. Load the source image with Images::fromFile and add it to the presentation image collection.

  4. Add the image to the slide with addPictureFrame, then save with SaveFormat::Ppt.

Free Online Converter

Try our free Conversion app

Convert Image To Other Supported Formats

You can also convert Image and save to other file formats. See all supported formats below: