1
voddie
Image resizing in Xoopspartners
  • 2005/5/28 15:51

  • voddie

  • Just popping in

  • Posts: 71

  • Since: 2003/10/20


Hi

Hope someone can assist, im trying to resize the image that is shown in Xoopspartners.

Ive found and edited the image shown in the admin, but after three hours i cannot work out which php the size is stated.

Can anyone assist please.

Voddie

2
m0nty
Re: Image resizing in Xoopspartners
  • 2005/5/28 16:00

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


you mean for the image in the block itself?

if so > edit the xoopspartners_blocks_site.html template.

line 40:

<img src="<{$partner.image}>" width="102" height="47" border="0" alt="<{$partner.url}>" <{$block.fadeImage}> />

3
voddie
Re: Image resizing in Xoopspartners
  • 2005/5/28 16:33

  • voddie

  • Just popping in

  • Posts: 71

  • Since: 2003/10/20


Hi Ive tried altering that file, that is mainly pointing to the random block image size.

The one im trying to alter is the image that appears in the main listings

Voddie

4
voddie
Re: Image resizing in Xoopspartners
  • 2005/5/28 16:37

  • voddie

  • Just popping in

  • Posts: 71

  • Since: 2003/10/20


Hi again

Thanks found it in the index.php under
Quote:
$ImagePartner .= "<img src='".$array_partners[$i]["image"]."' alt='".$array_partners[$i]["url"]."' width='102' height='47' border='0' />";



Thanks for your help

Voddie

5
snakes
Re: Image resizing in Xoopspartners
  • 2005/10/4 12:35

  • snakes

  • Just popping in

  • Posts: 69

  • Since: 2004/8/8 0


Here is a hack that force the resizing to keep the image proportion.
index.php: (about line 67)
add this code
$ImageSize getimagesize($array_partners[$i]["image"]);
    
$ImageWidth "";
    
$ImageHeight "";
    if(
is_array($ImageSize)) {
        if(
$ImageSize[0] >= $ImageSize[1]) $ImageWidth = ($ImageSize[0]>100 "100" $ImageSize[0]);
        else 
$ImageHeight = ($ImageSize[1]>100 "100" $ImageSize[1]);
    } else {
        
$ImageWidth "100";
    }

About line 78
Change
$ImagePartner .= "<img src='".$array_partners[$i]["image"]."' alt='".$array_partners[$i]["url"]."' width='102' height='47' border='0' />";

with
$ImagePartner .= "<img src='".$array_partners[$i]["image"]."' alt='".$array_partners[$i]["url"]."' ".(!empty($ImageHeight) ? "height="$ImageHeight"" "width="$ImageWidth"")." border='0' />";


block/partners.php: (about line 46)
add this code after
list($id$url$image$title) = $xoopsDB->fetchrow($result);

$ImageSize getimagesize($image);
        
$ImageWidth "";
        
$ImageHeight "";
        if(
is_array($ImageSize)) {
            if(
$ImageSize[0] >= $ImageSize[1]) $ImageWidth = ($ImageSize[0]>100 "100" $ImageSize[0]);
            else 
$ImageHeight = ($ImageSize[1]>100 "100" $ImageSize[1]);
        } else {
            
$ImageWidth "100";
        }
        
$partners['dimensions'] = (!empty($ImageHeight) ? "height="$ImageHeight"" "width="$ImageWidth"");


templates/blocks/xoopspartners_block_site.html: (about line 40).
Replace:
<img src="<{$partner.image}>" width="102" border="0" alt="<{$partner.url}>" <{$block.fadeImage}> /><br />

with:
<img src="<{$partner.image}>" <{$partner.dimensions}> border="0" alt="<{$partner.url}>" <{$block.fadeImage}> /><br />


Now go to admin section and click on the module upgrade button

6
fallenturtle
Re: Image resizing in Xoopspartners

This code works great for me except for one problem. If I go an try to edit a partner, it tells me it can't find the image... I don't have this problem when adding a partner, just when I edit one thats already there.

Any ideas?

7
snakes
Re: Image resizing in Xoopspartners
  • 2005/10/15 1:12

  • snakes

  • Just popping in

  • Posts: 69

  • Since: 2004/8/8 0


I don't have that problem with any of my sites.
Is the problem following the hack or did it exist even before?
Does the image url start with "http://" ? Even if the image is in your own website you must put the "http://" and not just the path.

8
NeoFenix
Re: Image resizing in Xoopspartners
  • 2006/1/4 15:08

  • NeoFenix

  • Just popping in

  • Posts: 31

  • Since: 2005/7/8 3


thankz! this hack works perfectly, cos my images are 140 x 140 ... but I wonder ... what if I want it rectangular? I haven't tried anything yet ... but ...


fallenturtle: I had the same problem, some time ago, so it has nothing to do with this hack .... I think ... I don't remember how I solve it, but when I do, I tell you.

Login

Who's Online

149 user(s) are online (85 user(s) are browsing Support Forums)


Members: 0


Guests: 149


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits