Jump to content

Help with editing thumbnail sizes using php


irishpeck

Recommended Posts

If you go to http://www.flog-it.ie you will see that the recent ads section is at the top and contains 5 images but they are different sizes but we want them all to be the same size. We have a file called latest.inc.php which displays these ads which can be seen below:

 

<?php

require_once("config.inc.php");

?>
<?php
if($latestads_count)
{
?>


<?php
    $sql = "SELECT a.*, ct.cityname, UNIX_TIMESTAMP(a.createdon) AS timestamp, feat.adid AS isfeat,
                COUNT(*) AS piccount, p.picfile AS picfile, scat.subcatname, scat.catid, cat.catname
            FROM $t_ads a
                INNER JOIN $t_cities ct ON a.cityid = ct.cityid
                INNER JOIN $t_subcats scat ON a.subcatid = scat.subcatid
                INNER JOIN $t_cats cat ON scat.catid = cat.catid
                LEFT OUTER JOIN $t_featured feat ON a.adid = feat.adid AND feat.adtype = 'A' AND feat.featuredtill >= NOW()
                LEFT OUTER JOIN $t_adpics p ON a.adid = p.adid AND p.isevent = '0'
            WHERE $visibility_condn
                $loc_condn
            GROUP BY a.adid
            ORDER BY a.createdon DESC
            LIMIT $latestads_count";
    $res_latest = mysql_query($sql) or die($sql.mysql_error());

    $css_first = "_first";
    while($row = mysql_fetch_array($res_latest))
    {
       
        $catname_inurl = RemoveBadURLChars($row['catname']);
        $subcatname_inurl = RemoveBadURLChars($row['subcatname']);

        if($sef_urls) $url = "{$vbasedir}$xcityid/posts/{$row[catid]}_{$catname_inurl}/{$row[subcatid]}_{$subcatname_inurl}/$row[adid]_" . RemoveBadURLChars($row['adtitle']) . ".html";
        else $url = "?view=showad&adid=$row[adid]&cityid=$xcityid&lang=$xlang{$link_extra}";

?>
   
        <?php
        if($row['isfeat'])
        {
            //$feat_class = "class=\"featured\"";
            $feat_img = "<img src=\"images/featured.gif\" align=\"absmiddle\">";
        }
        else
        {
            //$feat_class = "";
            $feat_img = "";
        }

        if($row['picfile'])
        {
            $picfile = $row['picfile'];
            $imgsize = GetThumbnailSize("{$datadir[adpics]}/{$picfile}", $tinythumb_max_width, $tinythumb_max_height);
        }
        else
        {
            $picfile = "";
        }
        ?>

         
            <?php if($picfile) { ?>
            <a href="<?php echo $url; ?>"><img src="<?php echo "{$datadir[adpics]}/{$picfile}"; ?>" border="0" width="<?php echo $imgsize[0]; ?>" height="<?php echo $imgsize[1]; ?>" style="border:1px solid black"></a>
            <?php } ?>
           
<?php
        $css_first = "";
    }
?>
</div>

<?php
}
?>

 

As you can see in the code we have this line which controls the thumbnail sizes

 

if($row['picfile'])
        {
            $picfile = $row['picfile'];
            $imgsize = GetThumbnailSize("{$datadir[adpics]}/{$picfile}", $tinythumb_max_width, $tinythumb_max_height);
        }
        else
        {
            $picfile = "";
        }
        ?>

 

And in our config.inc.php we have 2 variables --$tinythumb_max_width, $tinythumb_max_height-- I have these set as 100px X 100px but unfortunately its not changing the height. Is there anything else i can do to have these the same size?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.