0

I tried to list blob from MySQL using PHP, but images are not showing. I checked on the source page, source page result are given below.

data-url="<?php echo $eachImage; ?>" & data-thumbnail-path="<?php echo $eachImage; ?>" here I am expecting path. In view source page this section is showing some encripted data.

How can I get the image path from blob file?

<?php foreach ($this->carousel as $carousel): ?>

        <?php 
             if ($carousel['title'] == 'service') {
                $rs = Database::getInstance()
                      ->query("SELECT * FROM tl_carousel WHERE title = 'service' ");

                $result = $rs->fetchAllAssoc(); 
                $images = deserialize( $carousel['themesSRC'] );
                foreach ($images as $eachImage)
                {

                ?>

                <ul>
                    <li data-url="<?php echo $eachImage; ?>" data-width="800" data-height="500"></li>
                    <li data-thumbnail-path="<?php echo $eachImage; ?>"></li>
                    <li data-thumbnail-text="" data-thumbnail-text-title-offset="43" data-thumbnail-text-offset-top="16" data-thumbnail-text-offset-bottom="7">
                    <!-- <p class="largeLabel">CUSTOM TEXT CAN BE ADDED HERE</p> -->
                    <p class="smallLabel"><?php echo $carousel['title']; ?></p>
                    </li>

                    <li data-info="">
                    <!-- <p class="mediaDescriptionHeader">CUSTOM TEXT CAN BE ADDED HERE AND FORMATTED WITH CSS</p> -->
                    <p class="mediaDescriptionText"><?php echo $carousel['title']; ?></p>
                    </li>       
                </ul>

                <?php
                }
             } 
        ?>

        <?php endforeach; ?>

View source Result

enter image description here

1 Answer 1

1

Basically, to access images from blob, you use :

<img src="data:image/jpeg;base64,'.base64_encode($eachImage).'"/>

-> image/png for a png, or image/jpeg for a jpeg

Related (don't know if you'll need it, but worth reading)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.