Display and link images to themselves

I built a CMS system using CKEditor and KCFinder that store information od a databse via textarea/php. So far so good!

The issue comes to when I want to store and display images that link to themselves. The way I am storing images is exactly the same: There is a textarea where I insert an image via KCFinder/CKEditor. The image is uploaded to the server and the path stored at the database. Later I try to pick up that path from the database to display the image (that part also works) and because I want the image to link to itself, I try to use the same method to insert the url on the link. Problem? The link is missing.

Can anyone point me the error and suggest any solution? I would be so thankful!

Code:

[php]<?php
$sql = “SELECT * FROM php_maskiner ORDER BY timestamp DESC”;

$result = mysql_query($sql) or print ('<div class="alert alert-standard fade in">
    <a class="close" data-dismiss="alert" href="#">&times;</a>
    <strong>Can't read the database!</strong>
    </div>' . $sql . "<br />" . mysql_error());

        while($row = mysql_fetch_array($result)) {
            $title = stripslashes($row['title']);
            $entry = stripslashes($row['entry']);
            $images = html_entity_decode($row['images']);
            $img_url = $row['images'];
            $img_pack = '<div class="mask3 span3">
        <a rel="prettyPhoto" href="' . $img_url . '">' . $images . '</a>
        </div>';

?>

            <article class="span12 post"> 
                <?php echo $img_pack; ?>
                <div class="inside">
                  <div class="span8 entry-content">
                    <div class="span12">
                        <h2><?php echo $title; ?></h2>
                        <p><?php echo $entry; ?></p>
                    </div>
                  </div>
                </div>
            </article>
<?php

}
?>[/php]

Outputed HTML:
<a src="/nysida/admin/kcfinder/upload/images/1307594_10243178.jpg" “=”" href="<img alt=" rel=“prettyPhoto”>

">

<img src="/nysida/admin/kcfinder/upload/images/1307594_10243178.jpg" alt=""></img>

In your database

Does $row[‘images’]; contain

[php][/php]

or

[php]/nysida/admin/kcfinder/upload/images/1307594_10243178.jpg[/php]

The output you shown doesn’t match the code, which makes it weird.

Sponsor our Newsletter | Privacy Policy | Terms of Service