Novahq.net Forum

Novahq.net Forum (https://novahq.net/forum/index.php)
-   phphq.Net Forums (https://novahq.net/forum/forumdisplay.php?f=277)
-   -   phAlbum proportions (https://novahq.net/forum/showthread.php?t=40583)

sunkist 02-13-2008 10:50 PM

phAlbum proportions
 
Hos do you change the thumbnails to be proportionate? So that long and wide images aren't forced into the same dimensions?

Scott 02-14-2008 01:12 AM

While it is possible this version of phAlbum can't do it without some code modifications.. i'm not at home right now so I can't post some code. I'll try to remember to post it when I get back.

mtdew 02-25-2008 11:44 PM

is there a fix for this?

To make a thumb with a fixed width but height to be variable according to the original.

Thanks in advanced

atholon 03-05-2008 10:19 AM

Darn! I could help you to but the code is at home!

You could something like this:
Code:

function image_resize($iImage, $allowedwidth, $allowedheight)
{
          list($width, $height, $type, $attr) = getimagesize($iImage);

      if($width > $allowedwidth || $height > $allowedheight)
      {
       
          if ($width > $height)
          {
            $offset = $width / $allowedwidth ;
            if ($offset<=1)
            {
            $offset = $width - $allowed;
            $newimagewidth =$width - $offset;
            $newimageheight =$height - $offset;
            }
            else
            {
            $newimagewidth =$width / $offset;
            $newimageheight =$height / $offset;
          }           
   
          }
          elseif ($width < $height)
          {
            $offset = $height / $allowedwidth ;
            if ($offset<=1)
            {
            $offset = $height - $allowed;
            $newimagewidth =$width - $offset;
            $newimageheight =$height - $offset;
            }
            else
            {
            $newimagewidth =$width / $offset;
            $newimageheight =$height / $offset;
            }           
          }
}

PS I am not sure if that is the actual working code.

Happyman 09-10-2009 06:43 AM

did anyone get this code?`please PM me!

AloHa 03-31-2010 08:26 AM

I've need too of the code to phalbum with resize thumbs in proportion.
But the code upon don't work. Please post a right version. I think it is util to many user. Thanx

blthlt 08-26-2010 11:45 AM

any updates to this?

blthlt 09-09-2010 06:09 PM

guess not. looks like this forum may be dead.

Scott 09-09-2010 07:55 PM

Try this...

Right Before line 318, before this line:
PHP Code:

    imagecopyresized($imgresized$imgsoruce0000$thumb_width$thumb_height$imgdata[0], $imgdata[1]); 

Try adding this:

PHP Code:

        $x=$imgdata[0]/$thumb_width;
        
$y=$imgdata[1]/$thumb_height;
        
        If(
$y $x){
            
$thumb_width=round($imgdata[0] * ($y));
            
$thumb_height=round($imgdata[1] * ($y));
        } Else {
            
$thumb_width=round($imgdata[0] * ($x));
            
$thumb_height=round($imgdata[1] * ($x));
        } 

This is untested... Let me know if it works.

blthlt 09-10-2010 11:58 PM

no, the thumbs get progressively smaller as they load.

Scott 09-12-2010 02:06 AM

1 Attachment(s)
Alright.. I took a little bit of time and tested it.. you'll have to download the modified file though as I've made to many changes to document here. This one should work with proportions properly, as well as be compatible with php 5.3.x

blthlt 09-21-2010 08:55 PM

one more idea, is there any way to have the picture clicked to popup in the same window? Maybe the use of java or something?

Scott 09-22-2010 05:47 PM

Like a light box window?

blthlt 09-22-2010 10:09 PM

Yea, just so that it doesn't open a new "window". One with a left right arrow would be great! I'm no coder just helping out a family member.

Scott 09-23-2010 10:13 AM

Well right now I don't have alot of spare time to add things like to to phAlbum but i'm sure adding a jquery lightbox wouldn't be to difficult even for a non coder. You should do a search for jquery lightbox.

blthlt 09-24-2010 02:30 AM

got it working 1/2 way, just adds the lightbox to the bottom of the page....


All times are GMT -5. The time now is 03:00 AM.

Powered by vBulletin®