Resize Images in php

862 views Asked by At

I am having problem in resizing pictures. to show the uploaded images i have saved their path in database table and code to show images is:

$result = mysql_query("SELECT * FROM photos");
    while($row = mysql_fetch_array($result))
    {
            $name = 'name'; 
            echo '<div id="imagelist">';
            echo '<p ><img src="timthumb.php?src="' .$row['location']. '"&w=100&h=80"/></p>';
            echo '</div>';
            echo '<div id="imagelist">';

            echo '<p>' .$row['id']. '</p>';
            echo " ";
            echo '<p><b>Location:</b>' .$row['location']. '</p>';
            echo '<p><b>File Name:</b>' .$row['name']. '</p>';
            echo '<p><b>ID:</b>' .$row['au_id']. '</p>';
            echo '<p><b>Position:</b>' .$row['position']. '</p>';
            echo '<p><b>Contace info:</b>' .$row['contact']. '</p>';
            echo '</div>';          
    }

I am using timthumb and .$row['location']. has values like "photos/image.png". Page is unable to show the pictures, am I usning timthumb correctly?

1

There are 1 answers

4
Lkopo On
 echo '<p ><img src="timthumb.php?src="' .$row['location']. '"&w=100&h=80"/></p>';

Remove " " from URL:

echo '<p ><img src="timthumb.php?src=' .$row['location']. '&w=100&h=80"/></p>';