function fitHeight($height, $force = false) { $size = size::fit_height($this->width(), $this->height(), $height, $force); $this->info->width = $size['width']; $this->info->height = $size['height']; return $this; }
<?php include "../../../system.php"; include "../../system.php"; include "../../../function/new_function.php"; include "size_unit.php"; //System----------------------------------------------------------- $now_table = $pro_size_table; //System----------------------------------------------------------- $tool = new My_Tool(); $sam = new guard(); $unit = new size(); $name = trim($_POST['name']); $sql = "select * from `{$now_table}` where `name`='{$name}'"; $res = mysql_query($sql); if (mysql_num_rows($res) == 0) { if (!empty($name)) { $unit->table = $now_table; $unit->name = $name; $unit->add(); } }
function size() { $maxWidth = $this->maxWidth; $maxHeight = $this->maxHeight; $upscale = $this->upscale; if ($this->crop == true) { if (!$maxWidth) { $maxWidth = $maxHeight; } if (!$maxHeight) { $maxHeight = $maxWidth; } $sourceRatio = size::ratio($this->sourceWidth, $this->sourceHeight); $thumbRatio = size::ratio($maxWidth, $maxHeight); if ($sourceRatio > $thumbRatio) { // fit the height of the source $size = size::fit_height($this->sourceWidth, $this->sourceHeight, $maxHeight, true); } else { // fit the height of the source $size = size::fit_width($this->sourceWidth, $this->sourceHeight, $maxWidth, true); } $this->tmpWidth = $size['width']; $this->tmpHeight = $size['height']; $this->width = $maxWidth; $this->height = $maxHeight; return $size; } // if there's a maxWidth and a maxHeight if ($maxWidth && $maxHeight) { // if the source width is bigger then the source height // we need to fit the width if ($this->sourceWidth > $this->sourceHeight) { $size = size::fit_width($this->sourceWidth, $this->sourceHeight, $maxWidth, $upscale); // do another check for the maxHeight if ($size['height'] > $maxHeight) { $size = size::fit_height($size['width'], $size['height'], $maxHeight); } } else { $size = size::fit_height($this->sourceWidth, $this->sourceHeight, $maxHeight, $upscale); // do another check for the maxWidth if ($size['width'] > $maxWidth) { $size = size::fit_width($size['width'], $size['height'], $maxWidth); } } } elseif ($maxWidth) { $size = size::fit_width($this->sourceWidth, $this->sourceHeight, $maxWidth, $upscale); } elseif ($maxHeight) { $size = size::fit_height($this->sourceWidth, $this->sourceHeight, $maxHeight, $upscale); } else { $size = array('width' => $this->sourceWidth, 'height' => $this->sourceHeight); } $this->width = $size['width']; $this->height = $size['height']; return $size; }
<?php include "../../../system.php"; include "../../system.php"; include "../../../function/new_function.php"; include "size_unit.php"; //System----------------------------------------------------------- $now_table = $pro_size_table; $related_table = $pro_stock_table; //System----------------------------------------------------------- $tool = new My_Tool(); $sam = new guard(); $unit = new size(); $id = $_POST['id']; $unit->table = $now_table; $unit->id = $id; $unit->del(); //刪除關聯紀錄 $sql = "DELETE from `{$related_table}` where sid='{$id}'"; mysql_query($sql);