当前位置: 首页>>代码示例>>PHP>>正文


PHP cls_image::imageResize方法代码示例

本文整理汇总了PHP中cls_image::imageResize方法的典型用法代码示例。如果您正苦于以下问题:PHP cls_image::imageResize方法的具体用法?PHP cls_image::imageResize怎么用?PHP cls_image::imageResize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cls_image的用法示例。


在下文中一共展示了cls_image::imageResize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sms_make_images

function sms_make_images()
{
    global $_FILES, $Name, $Title;
    $res = runsql("select * from sms_images_types");
    while ($im = mysql_fetch_array($res)) {
        $f = $_FILES['Image'];
        //print $im[Name_rus];
        $image = new cls_image($f);
        $im[Name_rus] = str_replace("x", "х", $im[Name_rus]);
        $ar = explode("х", $im[Name_rus]);
        //print "-$ar[0] $ar[1]-<br>";
        $image->newWidth = $ar[0];
        $image->newHeight = $ar[1];
        $image->mix = "";
        $image->fix = "width";
        $image->mixpos = "";
        //print "1";
        $Small = new cls_image($image->imageResize());
        $id = $im[TypeID];
        $img1 = addslashes($Small->contents);
        $image = new cls_image($f);
        $image->newWidth = $ar[0];
        $image->newHeight = $ar[1];
        $image->fix = "width";
        $image->mix = "image.png";
        $image->mixpos = "center";
        //print "2";
        $Small2 = new cls_image($image->imageResize());
        //print "1 $ar[0] $ar[1] $Small2->contents";
        //exit;
        $img2 = addslashes($Small2->contents);
        mysql_query("insert into sms_images (\r\nName,Title,Preview,Image,Date,ImageDate,TypeID) values\r\n(\r\n'{$Name}',\r\n'{$Title}',\r\n\r\n'{$img1}',\r\n'{$img2}',\r\nunix_timestamp(),\r\nunix_timestamp(),\r\n'{$id}'\r\n)");
        image_sms(mysql_insert_id(), $id, $Title, $id);
    }
}
开发者ID:dapfru,项目名称:gladiators,代码行数:35,代码来源:config.php

示例2: mktime

 function set_form_params($str, $i)
 {
     global $search, $site_url, $engine_path, $r, $REMOTE_ADDR, $HTTP_POST_FILES, $HTTP_POST_VARS, $HTTP_GET_VARS, $id, $secpass, $lang, $auth, $er;
     $ndate = 0;
     $st = $str;
     if (count($HTTP_GET_VARS) > count($HTTP_POST_VARS)) {
         $HTTP_POST_VARS = $HTTP_GET_VARS;
     }
     if ($HTTP_POST_VARS['numrows']) {
         $mult = 1;
     }
     if (!$HTTP_POST_VARS['Time']) {
         $Time = mktime();
     }
     if (!$HTTP_POST_VARS['Date']) {
         $Date = mktime();
     }
     if (!$HTTP_POST_VARS['IP']) {
         $IP = $REMOTE_ADDR;
     }
     if ($this->act == "select") {
         $inner = $this->document->getElementsByTagName("header");
         $fields = $inner[0]->getElementsByTagName("item");
     } else {
         $inner = $this->document->getElementsByTagName("fields");
         $fields = $inner[0]->getElementsByTagName("field");
     }
     foreach ($fields as $field) {
         $item = $this->getTemplateControl($field);
         //$name=$field->getAttribute("name","no");
         $name = $item->name;
         if ($name == "IP") {
             ${$name} = $REMOTE_ADDR;
         }
         $items[$name] = $item;
         if ($item->default && !$HTTP_POST_VARS[$name]) {
             $HTTP_POST_VARS[$name] = $item->default;
         } elseif ($item->type == "stringlike") {
             $HTTP_POST_VARS[$name] = "%{$HTTP_POST_VARS[$name]}%";
         }
         if ($HTTP_POST_VARS[$name] == "%%") {
             $HTTP_POST_VARS[$name] = "%";
         }
         if ($mult) {
             $f['name'] = $HTTP_POST_FILES[$name]['name'][$i];
             $f['tmp_name'] = $HTTP_POST_FILES[$name]['tmp_name'][$i];
             $f['size'] = $HTTP_POST_FILES[$name]['size'][$i];
             $f['type'] = $HTTP_POST_FILES[$name]['type'][$i];
         } else {
             $f = $HTTP_POST_FILES[$name];
         }
         $type = $item->type;
         if (($type == "file" || $type == "image" || $type == "flag") && $f[name]) {
             $file = fopen($f['tmp_name'], "r");
             //print $f[name].$f['tmp_name'];
             //exit;
             if (!$file) {
                 $er = sysmessage(4) . "<br>";
             }
             $fname = $f['tmp_name'];
             $maxsize = $field->getAttribute("maxsize", '');
             $format = $field->getAttribute("format", '');
             if (!strstr($format, strtolower(substr($f['name'], strpos($f['name'], ".") + 1))) && $format) {
                 $er = sysmessage(5) . " .{$format}!<br>";
             }
             ${$name} = fread($file, filesize($fname));
             //обработка файлов--------------------
             if ($item->type == "file" && $f[name]) {
                 if (!$id) {
                     $q = select("select 1+max(" . $name . "ID) from " . $this->table);
                 } else {
                     $q[0] = $id;
                 }
                 $dir = "files/" . $q[0] . "." . substr($f['name'], 1 + strpos($f['name'], "."));
                 move_uploaded_file($fname, $engine_path . $dir);
                 ${$name} = $site_url . $dir;
                 //print $par_val;
                 //exit;
             }
         }
         if (($type == "flag" || $type == "image") && $f[name]) {
             $image = new cls_image($f);
             $image->maxsize = $field->getAttribute("maxsize", '');
             $image->mix = $field->getAttribute("mix", '');
             $image->mixpos = $field->getAttribute("mixpos", '');
             if ($width = $field->getAttribute("width", '')) {
                 $image->newWidth = $width;
                 $image->fix = "width";
             }
             if ($height = $field->getAttribute("height", '')) {
                 $image->newHeight = $height;
                 $image->fix = "height";
             }
             $image->check();
             ${$name} = $image->contents;
             $Type = $image->type;
             $ph[$name] = 1;
             $ph['Small'] = 1;
             if ($image->type != "gif") {
                 $Small = new cls_image($image->imageResize());
//.........这里部分代码省略.........
开发者ID:dapfru,项目名称:gladiators,代码行数:101,代码来源:cls_form_dinamo.php

示例3: elseif


//.........这里部分代码省略.........
                 }
                 if ($fix = $field['fix']) {
                     $image->fix = $fix;
                 }
             }
             if ($_POST['UploadedImage'] == 1) {
                 $file_name = $site_path . "/images/" . $this->table . "/" . strtolower($name) . "/0.jpg";
                 $file = fopen($file_name, "r");
                 $image->contents = fread($file, filesize($file_name));
                 fclose($file);
                 $image->type = "jpeg";
             } else {
                 $image->check();
             }
             ${$name} = $image->contents;
             $im_array[$im_count]['name'] = $item->name;
             $im_array[$im_count]['image'] = $image->contents;
             if (($width || $height) && $image->type == "gif") {
                 if ($this->mode == 1) {
                     if (!($bgcolor = $field->getAttribute("bgcolor", ''))) {
                         $bgcolor = "515E64";
                     } elseif (!($bgcolor = $field['bgcolor'])) {
                         $bgcolor = "515E64";
                     }
                 }
                 if ($width && $image->width > $width || $height && $image->height > $height) {
                     $image->gif2jpeg($bgcolor);
                 }
             }
             $Type = $image->type;
             $ph[$name] = 1;
             $ph['Small'] = 1;
             if ($image->type != "gif") {
                 $Small = new cls_image($image->imageResize());
                 unlink($engine_path . "tmp/" . $image->name);
                 $Small = $Small->contents;
             } else {
                 $Small = ${$name};
             }
             if ($_POST['UploadedImage'] == 1) {
                 $file_name = $site_path . "/images/" . $this->table . "/" . "small" . "/0.jpg";
                 $file = fopen($file_name, "r");
                 $Small = fread($file, filesize($file_name));
                 fclose($file);
                 $file_name = $site_path . "/images/" . $this->table . "/" . strtolower($name) . "/0.jpg";
                 $file = fopen($file_name, "r");
                 $image->contents = fread($file, filesize($file_name));
                 fclose($file);
             }
             $im_array[$im_count]['small'] = $Small;
             $im_array[$im_count]['type'] = $image->imtype;
             $im_count++;
             $ImageFormat = $image->imtype;
         } elseif ($type == "date" || $type == "currentdate" || $type == "datetime" || $type == "currentdatetime") {
             ${$name} = mktime($_POST['hour'][$ndate], $_POST['minute'][$ndate], $_POST['seconds'][$ndate], $_POST['month'][$ndate], $_POST['day'][$ndate], $_POST['year'][$ndate]);
             if (${$name} == -1 || !$_POST['month'][$ndate] || !$_POST['day'][$ndate] || !$_POST['year'][$ndate]) {
                 unset(${$name});
             }
             $ndate++;
         } elseif ($type == "sqldate") {
             ${$name} = $_POST['year'][$ndate] . "-" . $_POST['month'][$ndate] . "-" . $_POST['day'][$ndate];
             if (${$name} == -1 || !$_POST['month'][$ndate] || !$_POST['day'][$ndate] || !$_POST['year'][$ndate]) {
                 unset(${$name});
             }
             $ndate++;
         }
开发者ID:dapfru,项目名称:gladiators,代码行数:67,代码来源:cls_form.php


注:本文中的cls_image::imageResize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。