Support Forums

Old 01-15-2009, 04:14 PM   #1
Member
 
Join Date: Aug 2008
Posts: 62
Rep Power: 4
nagrap2 is on a distinguished road
Default Image Sizing

Hi,

I am trying to size all images under New Listings so that they are the same dimensions.

I have a smarty function (I have provided an extract below) to build my output which outputs the "New Tutors" section with photos.

However, if I want to set the height and width of the images to say 100 and 80, then how do I set that? The reason for setting all image dimensions to the same is so that they display neatly.


for ($x = 0; $x<= $loop_count; $x++)
{
//opening tr
$output .= "<tr" . smarty_function_html_table_cycle_newlistings('tr', $tr_attr, $c) . ">\n";
//opening td
$output .= "<td" . smarty_function_html_table_cycle_newlistings('td', $td_attr, $c) . ">\n";
//title
if(defined('SEO'))
{
$listing_title=$loop[$x][title];
$listing_title=str_replace(' ', '_', $listing_title);
$listing_title=preg_replace('/\W/e', '', $listing_title);
$output.="<a href='listing/".$loop[$x][id]."/".$listing_title.".html'>".$loop[$x][title]."</a>";
}
else
{
$output.="<a href='viewlisting.php?view=". $loop[$x][id] ."'>".$loop[$x][title]."</a>";
}
$output.="</td>\n";
$output .= "<td" . smarty_function_html_table_cycle_newlistings('td', $td_attr, $c) . ">\n";
//price
$output.=$loop[$x][price];
$output.="</td>\n";
$output .= "<td" . smarty_function_html_table_cycle_newlistings('td', $td_attr, $c) . ">\n";
//date
//$output.=smarty_modifier_date_format($loop[$x][dateadded], $date_format);
//closing td
$output.="</td>\n";
$output .= "</tr>\n";
}
__________________
Many Thanks,

Nagrap2

Developer Version 4.1
nagrap2 is offline   Reply With Quote
Old 01-15-2009, 04:43 PM   #2
Moderator
 
 
Join Date: Mar 2006
Posts: 4,064
Rep Power: 99
Lhotch is just really niceLhotch is just really nice
Default

HTML Images

Keep in mind if you force an image to a fixed size you will almost always compress or stretch the image. It may line up nice and nead put looks MUCH worse than images of slightly different sizes if you ask me.
__________________
Larry.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Lhotch is offline   Reply With Quote
Old 01-16-2009, 07:58 AM   #3
Member
 
Join Date: Aug 2008
Posts: 62
Rep Power: 4
nagrap2 is on a distinguished road
Default

Larry,

I understand the image could look worse, but for now can you advise how I actually make it a fixed size?

Thanks in advance...
__________________
Many Thanks,

Nagrap2

Developer Version 4.1
nagrap2 is offline   Reply With Quote
Old 01-16-2009, 08:20 AM   #4
Moderator
 
 
Join Date: Mar 2006
Posts: 4,064
Rep Power: 99
Lhotch is just really niceLhotch is just really nice
Default

Quote:
Originally Posted by nagrap2 View Post
Larry,

I understand the image could look worse, but for now can you advise how I actually make it a fixed size?

Thanks in advance...
I just gave you a link to an html tutorial and near the bottom is an example of adjusting the image size.
__________________
Larry.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Lhotch is offline   Reply With Quote
Old 01-16-2009, 11:00 AM   #5
Member
 
Join Date: Aug 2008
Posts: 62
Rep Power: 4
nagrap2 is on a distinguished road
Default

Larry,

The only problem I have is the smarty code I have posted above is alittle confusing to me. I cannot find where the img is created? I see the href tag, but don't know how the img part is being generated. Once I figure that out I can add the height and width attributes.

Any ideas?
__________________
Many Thanks,

Nagrap2

Developer Version 4.1
nagrap2 is offline   Reply With Quote
Old 01-16-2009, 11:05 AM   #6
Moderator
 
 
Join Date: Mar 2006
Posts: 4,064
Rep Power: 99
Lhotch is just really niceLhotch is just really nice
Default

Quote:
Originally Posted by nagrap2 View Post
Larry,

The only problem I have is the smarty code I have posted above is alittle confusing to me. I cannot find where the img is created? I see the href tag, but don't know how the img part is being generated. Once I figure that out I can add the height and width attributes.

Any ideas?
I dont know every single line of the more than 10,000 lines of code that make up 68C and all you did was post a snippet of code (which is php and not smarty by the way) but didnt say where you got or even exactly specify what section of the page your viewing in reference to the images you want to set the dimensions of.

People here are willing to help but we are not mind readers so your going to have to give us more to go on.
__________________
Larry.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Lhotch is offline   Reply With Quote
Old 01-16-2009, 12:40 PM   #7
Member
 
Join Date: Aug 2008
Posts: 62
Rep Power: 4
nagrap2 is on a distinguished road
Default

Larry,

Sorry for the confusion.

The code is in a function called "new_listings" in the following location:

homepage\includes\classes\smarty\plugins

Code:

function smarty_function_new_listings($params, &$smarty)
{
global $db;

$table_attr = 'border="1"';
$tr_attr = '';
$td_attr = '';
$number=4;
$cols=4;
$rows=3;
$trailpad = ' ';
$vdir = 'down';
$hdir = 'right';
$inner = 'cols';

foreach ($params as $_key=>$_value)
{
switch ($_key)
{
case 'number':
$$_key = (int)$_value;
break;

case 'table_attr':
$$_key = (string)$_value;
break;

case 'tr_attr':
case 'td_attr':
$$_key = $_value;
break;
}
}

$sSQL="SELECT p.id, p.owner, p.title, p.featured, p.section, p.description, p.price, p.dateadded, p.expiration, p.pHighlighted, p.pBold, u.state, u.city, u.country FROM ".PREFIX."listings AS p LEFT JOIN ".PREFIX."users AS u ON p.owner = u.id WHERE p.expiration > NOW() AND p.display = 'Y' ORDER BY p.dateadded DESC LIMIT ".$number;
$result=$db->query($sSQL);
$i=0;
while($row=$result->fetch())
{
$tmp = array(
'id' => $row['id'],
'title'=> $row['title'],
'dateadded'=>$row['dateadded'],
'price'=> FormatCurrency($row['price']),
);
$loop[$i] = $tmp;
$i++;
}
$loop_count = count($loop)-1;

$output = "<table " . $table_attr.">\n";
for ($x = 0; $x<= $loop_count; $x++)
{
//opening tr
$output .= "<tr" . smarty_function_html_table_cycle_newlistings('tr', $tr_attr, $c) . ">\n";
//opening td
$output .= "<td" . smarty_function_html_table_cycle_newlistings('td', $td_attr, $c) . ">\n";
//title
if(defined('SEO'))
{
$listing_title=$loop[$x][title];
$listing_title=str_replace(' ', '_', $listing_title);
$listing_title=preg_replace('/\W/e', '', $listing_title);
$output.="<a href='listing/".$loop[$x][id]."/".$listing_title.".html'>".$loop[$x][title]."</a>";
}
else
{
$output.="<a href='viewlisting.php?view=". $loop[$x][id] ."'>".$loop[$x][title]."</a>";
}
$output.="</td>\n";
$output .= "<td" . smarty_function_html_table_cycle_newlistings('td', $td_attr, $c) . ">\n";
//price
$output.=$loop[$x][price];
$output.="</td>\n";
$output .= "<td" . smarty_function_html_table_cycle_newlistings('td', $td_attr, $c) . ">\n";
//date
//$output.=smarty_modifier_date_format($loop[$x][dateadded], $date_format);
//closing td
$output.="</td>\n";
$output .= "</tr>\n";
}
$output .= "</table>\n";

return $output;
}

function smarty_function_html_table_cycle_newlistings($name , $var, $no)
{
if(!is_array($var))
{
$ret = $var;
}
else
{
$ret = $var[$no % count($var)];
}
return ($ret) ? ' '.$ret : '';
}
__________________
Many Thanks,

Nagrap2

Developer Version 4.1
nagrap2 is offline   Reply With Quote
Old 01-16-2009, 01:08 PM   #8
Moderator
 
 
Join Date: Mar 2006
Posts: 4,064
Rep Power: 99
Lhotch is just really niceLhotch is just really nice
Default

Quote:
Originally Posted by nagrap2 View Post
Larry,

Sorry for the confusion.

The code is in a function called "new_listings" in the following location:

Have you added a call to the plugin in one of your templates? By default I dont think its actually used. On top of that, that particular plugin doesnt display images, thats why you cant find in the code where to specify there size.

P.S. There really isnt any need to include the contents of the file as long as you tell me what file your looking at.
__________________
Larry.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Lhotch is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide image when no image is uploaded? MiśUszatek v4 Modules / Modifications 1 09-11-2008 08:37 PM
Thumbnails - sizing problem seymourjames v4 Questions & Support 9 07-03-2008 04:38 PM
Question regarding listing image popup sizing civ v3.1 Questions & Support 5 10-12-2006 05:47 AM
Display an image over another image Bucketman v3.0 Questions & Support 2 04-21-2006 11:27 AM


All times are GMT -4. The time now is 04:37 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0