This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function resize_image($file, $w, $h, $crop=FALSE) { | |
list($width, $height) = getimagesize($file); | |
$r = $width / $height; | |
if ($crop) { | |
if ($width > $height) { | |
$width = ceil($width-($width*abs($r-$w/$h))); | |
} else { | |
$height = ceil($height-($height*abs($r-$w/$h))); | |
} | |
$newwidth = $w; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cmd import Cmd | |
class MyCmd(Cmd): | |
def onecmd(self, str): | |
if str == 'ls': | |
# here we should print the files in the cwd | |
print 'No files. Sorry!' | |
def precmd(self, line): |
NewerOlder