How to Deal with Different Aspect Ratios when Splitting Presentation Slides in PHP?

Hello. We are converting powerpoint slides to jpeg images using the splitOnline method of the SlidesApi. The images that come out on the frontend have low resolution. Adjusting the width and height parameters messes up the aspect ratio. How do we fix the resolution of the images while also accounting for different aspect ratios?

@camh,
Thank you for posting the question.

To investigate the case and help you, we need more details. Please share the following files and information:

  • sample presentation file
  • code example that reproduces the problem
  • output image files
  • Aspose.Slides Cloud SDK version you used

You can zip the files and upload an archive here.

We are using v22.3.0. I have uploaded the other files, let me know if they are sufficient.
untitled folder.zip (594.6 KB)

@camh,
Thank you for the additional information. You can upload the file to the Cloud storage, get the width and height of the presentation slides, and calculate the aspect ratio. The following code example shows you how to do this:

$fileName = "Status report.pptx";

$fileStream = fopen($fileName, 'r');
$api->uploadFile($fileName, $fileStream);

$slideProperties = $api->getSlideProperties($fileName);

$slideWidth = $slideProperties->getWidth();
$slideHeight = $slideProperties->getHeight();

$aspectRatio =  $slideWidth / $slideHeight;

You can then choose the width and height of your images while keeping the aspect ratio. Please note that the presentation file is uploaded to the storage, so you then should use the split method instead of the splitOnline.