0

I am trying to make simple presentation with two images per slide but I don't know how to put 2 images per slide. All images goes to one slide.

This is how it looks enter image description here

This is what I want enter image description here

Could you please help me with this. This is my code: (THIS CODE IS NOW FIXED)

$counter = 0;
$query = "SELECT izvestaji.operacija, izvestaji.ucinak, izvestaji.id, projekti.naziv, operacije.nazivEng FROM izvestaji INNER JOIN projekti ON izvestaji.projekatId=projekti.id INNER JOIN operacije ON izvestaji.operacijaId=operacije.id WHERE izvestaji.datum='$datum' AND izvestaji.projekatId='$projekatId'";
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {

            // Create a slide
            echo date('H:i:s') . ' Create templated slide' . EOL;


            // Shape
            echo date('H:i:s') . ' Create a shape (rich text)' . EOL;

            $id = $row['id'];

            $query2 = "SELECT img_name FROM slike WHERE izvestajId='$id' AND datum='$datum'";
            $result2 = mysqli_query($con, $query2);

            while ($row2 = mysqli_fetch_array($result2)) {

            if ($counter % 2 == 0) {
                $currentSlide = createTemplatedSlide($objPHPPresentation);
                $shape1 = $currentSlide->createDrawingShape();
                $shape1->setName('Part page');
                $shape1->setDescription('Page');
                $shape1->setPath('../../../../files/izvestaji/' . $project . '/' . $datum . '/' . $row['nazivEng'] . '/' . $row2['img_name']);
                $shape1->setResizeProportional(false);
                $shape1->setOffsetX(75);
                $shape1->setOffsetY(300);
                $shape1->setHeight(400);
                $shape1->setWidth(400);
            } else {
                $shape1 = $currentSlide->createDrawingShape();
                $shape1->setName('Part page');
                $shape1->setDescription('Page');
                $shape1->setPath('../../../../files/izvestaji/' . $project . '/' . $datum . '/' . $row['nazivEng'] . '/' . $row2['img_name']);
                $shape1->setResizeProportional(false);
                $shape1->setOffsetX(495);
                $shape1->setOffsetY(300);
                $shape1->setHeight(400);
                $shape1->setWidth(400);

            }
                $counter++;
            }
     $counter = 0;
}

You can see full code ON THIS LINK

4

1 回答 1

0

您需要每两张图片创建一张新幻灯片。移动这一行:

$currentSlide = createTemplatedSlide($objPHPPresentation);

到这里:

if ($counter % 2 == 0) {
    $currentSlide = createTemplatedSlide($objPHPPresentation);
    $shape1 = $currentSlide->createDrawingShape();
    // ...
于 2019-11-05T21:40:25.733 回答