Go Back   Novahq.net Forum > phphq.Net > phphq.Net Forums

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-13-2008, 11:50 PM
sunkist is offline sunkist
Registered User

Join Date: Feb 2008
Posts: 1

phAlbum proportions

Hos do you change the thumbnails to be proportionate? So that long and wide images aren't forced into the same dimensions?
Reply With Quote
  #2  
Old 02-14-2008, 02:12 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,545

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.
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #3  
Old 02-26-2008, 12:44 AM
mtdew is offline mtdew
Registered User

Join Date: Feb 2008
Posts: 1

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
Reply With Quote
  #4  
Old 03-05-2008, 11:19 AM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,349

Send a message via MSN to atholon
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.
__________________

My site: http://www.codeprotocol.com
"Bro, you are so full of win, if I slashed you with a kitchen knife, you'd be bleeding awesomeness." - Chrispy

Last edited by atholon; 03-05-2008 at 11:44 AM.
Reply With Quote
  #5  
Old 09-10-2009, 07:43 AM
Happyman is offline Happyman
Registered User

Join Date: Sep 2009
Posts: 6

did anyone get this code?`please PM me!
Reply With Quote
  #6  
Old 03-31-2010, 09:26 AM
AloHa is offline AloHa
Registered User

Join Date: Mar 2010
Posts: 1

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
Reply With Quote
  #7  
Old 08-26-2010, 12:45 PM
blthlt is offline blthlt
Registered User

Join Date: Aug 2010
Posts: 7

any updates to this?
Reply With Quote
  #8  
Old 09-09-2010, 07:09 PM
blthlt is offline blthlt
Registered User

Join Date: Aug 2010
Posts: 7

guess not. looks like this forum may be dead.
Reply With Quote
  #9  
Old 09-09-2010, 08:55 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,545

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.
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #10  
Old 09-11-2010, 12:58 AM
blthlt is offline blthlt
Registered User

Join Date: Aug 2010
Posts: 7

no, the thumbs get progressively smaller as they load.
Reply With Quote
  #11  
Old 09-12-2010, 03:06 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,545

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
Attached Files
File Type: zip phAlbum-proportions.zip (7.3 KB, 26 views)
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #12  
Old 09-21-2010, 09:55 PM
blthlt is offline blthlt
Registered User

Join Date: Aug 2010
Posts: 7

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?
Reply With Quote
  #13  
Old 09-22-2010, 06:47 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,545

Like a light box window?
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #14  
Old 09-22-2010, 11:09 PM
blthlt is offline blthlt
Registered User

Join Date: Aug 2010
Posts: 7

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.
Reply With Quote
  #15  
Old 09-23-2010, 11:13 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,545

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.
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #16  
Old 09-24-2010, 03:30 AM
blthlt is offline blthlt
Registered User

Join Date: Aug 2010
Posts: 7

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


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
phAlbum corny phphq.Net Forums 0 03-11-2009 11:21 AM
phAlbum billian phphq.Net Forums 5 09-24-2008 04:49 PM
phalbum error liamdawe phphq.Net Forums 1 12-09-2007 05:05 PM
PhAlbum tazz0710 phphq.Net Forums 2 12-07-2007 11:55 AM
phAlbum tazz0710 phphq.Net Forums 9 10-26-2007 01:28 AM


All times are GMT -5. The time now is 12:26 AM.




Powered by vBulletin®