PHPPowerPoint is a great library, but it has no documentation. What is the proper syntax for adding images to a slide?
Asked
Active
Viewed 2,492 times
1
-
Have you downloaded the source code yet, they have a folder called `Test` which shows you how to do this in the `01simple.php` example – PhearOfRayne Dec 20 '12 at 01:28
2 Answers
3
$currentSlide = createTemplatedSlide($objPHPPowerPoint);
// createTemplatedSlide is manual function in PHPpowerPoint
// create a drawing shape object
$shape1 = $currentSlide->createDrawingShape();
$shape1->setName("set name here");
$shape1->setDescription('Link Image');
$shape1->setPath('provide image path here');
$shape1->setWidth(45); // set width
$shape1->setHeight(45); // set height
$shape1->setOffsetX($offset_X); // distance from the left side of the slide
$shape1->setOffsetY($offset_Y); // distance from top of the slide

Ali Haider
- 92
- 2
2
Each graphical object is considered as a "shape". here is the way to insert an image into the slide:
// Create slide 1
$currentSlide = createTemplatedSlide($objPHPPowerPoint);
//Slide Content
$shape = $currentSlide->createDrawingShape();
$shape->setName('Part page');
$shape->setDescription('Page');
$shape->setPath('D:\wamp\www\Project\PPTResource\Part2\Image.jpg'); //This being the directory, wont be the same as mine.
$shape->setOffsetX(10); //Default values on position of image
$shape->setOffsetY(10);
$shape->getShadow()->setVisible(true);
$shape->getShadow()->setDirection(45);
$shape->getShadow()->setDistance(10);

Jamie Brindley
- 21
- 3