The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 24, 2012, 05:20:24 PM

Login with username, password and session length


Pages: 1 [2]
  Print  
Author Topic: how to automate scalling images !  (Read 1342 times)
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 9896



View Profile
« Reply #15 on: June 18, 2009, 02:29:28 PM »

Hey B, nice to see you around Smiley
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
arms
Expert
****
Offline Offline

Posts: 235



View Profile
« Reply #16 on: June 18, 2009, 08:22:54 PM »

the package name for pil on ubuntu is python-imaging.

heads up to anyone who uses python + imagemagick - ubuntu 9.04 and pythonmagick don't fucking play nice.

had to compile imagemagick + pythonmagick myself and it wasn't fun.
Logged
Bertje
Rookie
**
Offline Offline

Posts: 17


View Profile
« Reply #17 on: June 19, 2009, 06:51:24 AM »

Quote
Hey B, nice to see you around

Thanks. I'm around quite often, it's just that I only understand about 10% of what's discussed here.
Logged

No links in signatures please
NYDAz
Expert
****
Offline Offline

Posts: 210


The night stalker


View Profile WWW
« Reply #18 on: June 19, 2009, 07:49:47 AM »

Thanks. I'm around quite often, it's just that I only understand about 10% of what's discussed here.

we need to understand everything  Nerd
Logged

I'm an educated fool, with money on my mind !
serialnoob
Journeyman
***
Offline Offline

Posts: 87


View Profile
« Reply #19 on: June 19, 2009, 11:41:51 AM »

not sure i followed everyhting (friday), but in my country we do it like:

Code:
function scale_image($p,$mw='',$mh='', $alt='image', $brd=0) { // path, max_width, max_height, (source php.net)
    if(list($w,$h) = @getimagesize($p)) {
        $wh = @getimagesize($p);
        foreach(array('w','h') as $v) {
            $m = "m {$v}";
            if($ {$v} > $ {$m} && $ {$m}) {
                $o = ($v == 'w') ? 'h' : 'w';
                $r = $ {$m} / $ {$v}; $ {$v} = $ {$m}; $ {$o} = ceil($ {$o} * $r);
            }
        }
        return array("<img src=' {$p}' alt=' {$alt}' width=' {$w}' height=' {$h}' border=' {$brd}'/>", $wh[0], $wh[1]);
    }
}

then again I might not be in the right country!
Logged

Success consists of going from failure to failure without loss of enthusiasm - Winston Churchill
Pages: 1 [2]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!