Convert JPG to HTML in PHP
Place a JPG image on a presentation slide and export the result as HTML with Aspose.Slides for PHP via Java.
Convert JPG to HTML in PHP
Aspose.Slides for PHP via Java lets you place a JPG image on a presentation slide at its original dimensions and export the result as HTML.
Aspose.Slides can export JPG-based slides to HTML, PDF, PowerPoint, and other supported formats.
Convert JPG to HTML using PHP
To convert a JPG image to HTML, create a Presentation, add the image with addPictureFrame, and call save with SaveFormat::Html5.
PHP code for converting JPG into HTML
$presentation = new Presentation();
try {
$slide = $presentation->getSlides()->get_Item(0);
$sourceImage = Images::fromFile("input.jpg");
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.html", SaveFormat::Html5);
} finally {
$presentation->dispose();
}
How to convert JPG to HTML using Aspose.Slides for PHP API
These are the steps to convert JPG to HTML in PHP.
Install Aspose.Slides for PHP via Java .
Configure Aspose.Slides in your PHP project.
Load the JPG image with
Images::fromFileand add it to the presentation image collection.Add the image to the slide with
addPictureFrame, then save withSaveFormat::Html5.
Free Online Converter
Convert JPG To Other Supported Formats
You can also convert JPG and save to other file formats. See all supported formats below: