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


PHP createThumb函数代码示例

本文整理汇总了PHP中createThumb函数的典型用法代码示例。如果您正苦于以下问题:PHP createThumb函数的具体用法?PHP createThumb怎么用?PHP createThumb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: thumbs

function thumbs($imgs)
{
    $data = '';
    foreach ($imgs as $img) {
        $data .= createThumb($img) . "\n";
    }
    return $data;
}
开发者ID:sziszu,项目名称:pefi,代码行数:8,代码来源:assets.php

示例2: processFileUploads

 function processFileUploads()
 {
     if (!$_FILES['poster']['error']) {
         /*
         Некрасиво, надо это все в хэлпер запихать!
         */
         $dest = ROOT . DS . 'public' . DS . 'posters' . DS . $_FILES['poster']['name'];
         $relpath = substr('posters/' . $_FILES['poster']['name'], 0, -4);
         if ($_FILES['poster']['type'] == 'image/jpeg') {
             move_uploaded_file($_FILES['poster']['tmp_name'], $dest);
             $source = imagecreatefromjpeg($img);
             createThumb($dest, 100, 145);
             return $_FILES['poster']['name'];
         }
     }
 }
开发者ID:kix,项目名称:kphp,代码行数:16,代码来源:ItemsController.php

示例3: addFileToProject

function addFileToProject($file, $metas, $tcIn, $tcOut)
{
    global $project;
    global $racine;
    //echo $file."=".$tc;
    $tcIn = floatval($tcIn);
    $tcOut = floatval($tcOut);
    $document = $project->createElement("document");
    $finfo = finfo_open(FILEINFO_MIME_TYPE);
    $user = "";
    if (fileowner($file) != FALSE) {
        $user = fileowner($file);
        $user = posix_getpwuid($user);
        $user = explode(",", $user["gecos"]);
        $user = $user[0];
    }
    //Création des métadatas
    $metasAdd = array("Rekall->Comments" => "", "File->Hash" => strtoupper(sha1_file($file)), "Rekall->Flag" => "File", "File->Thumbnail" => "", "File->Owner" => $user, "File->MIME Type" => finfo_file($finfo, $file), "File->File Type" => finfo_file($finfo, $file), "Rekall->Type" => finfo_file($finfo, $file), "File->File Name" => pathinfo($file, PATHINFO_BASENAME), "File->Extension" => pathinfo($file, PATHINFO_EXTENSION), "File->Basename" => pathinfo($file, PATHINFO_FILENAME), "Rekall->Name" => pathinfo($file, PATHINFO_FILENAME), "Rekall->Extension" => strtoupper(pathinfo($file, PATHINFO_EXTENSION)), "Rekall->Folder" => "", "Rekall->File Size" => filesize($file), "Rekall->File Size (MB)" => filesize($file) / (1024.0 * 1024.0));
    $metas = array_merge($metas, $metasAdd);
    $key = "/" . $metas["Rekall->Folder"] . $metas["File->File Name"];
    $metas["key"] = $key;
    //Génère une vignette
    $fileDestBasename = strtoupper(sha1($metas["Rekall->Folder"]) . "-" . $metas["File->Hash"]);
    $fileDest = "../file/rekall_cache/" . $fileDestBasename . ".jpg";
    createThumb($file, $fileDest, 160);
    if (file_exists($fileDest)) {
        $metas["File->Thumbnail"] = $fileDestBasename;
    }
    //Ajout des métadatas
    foreach ($metas as $metaCategory => $metaContent) {
        $meta = $project->createElement("meta");
        $meta->setAttribute("ctg", $metaCategory);
        $meta->setAttribute("cnt", $metaContent);
        $document->appendChild($meta);
        $racine->appendChild($document);
    }
    //Tag de timeline
    $tag = $project->createElement("tag");
    $tag->setAttribute("key", $key);
    $tag->setAttribute("timeStart", $tcIn);
    $tag->setAttribute("timeEnd", $tcOut);
    $tag->setAttribute("version", 0);
    $racine->appendChild($tag);
    return $metas;
}
开发者ID:avilleret,项目名称:Rekall,代码行数:45,代码来源:project.php

示例4: handleFileupload

function handleFileupload()
{
    $allowedExts = array("jpg", "jpeg", "gif", "png");
    $upload = $_FILES["file"];
    $filename = $upload["name"];
    $extension = strtolower(end(explode(".", $filename)));
    if (!in_array($extension, $allowedExts)) {
        die("ACHTUNG: Scheint keine Bilddatei zu sein: {$filename}");
    }
    if ($upload["error"] > 0) {
        die("Return Code: " . $upload["error"]);
    }
    $prefix = time() . "-";
    $destination = TARGET_DIRECTORY . "/" . $prefix . $filename;
    $from = $upload["tmp_name"];
    move_uploaded_file($from, $destination);
    createThumb($destination, TARGET_DIRECTORY . "/" . $prefix . "thumb-" . $filename);
}
开发者ID:newcron,项目名称:juebe-modelle,代码行数:18,代码来源:upload.php

示例5: createThumbsFromFolder

function createThumbsFromFolder($thisAlbumPath, $thisThumbnailAlbumPath)
{
    if (is_dir("{$thisThumbnailAlbumPath}") == 0) {
        mkdir("{$thisThumbnailAlbumPath}", 0777);
        print "<TR><TD align='left' colspan='2'><font face='arial, helvetica' size='small'><b>{$thisThumbnailAlbumPath} created</b> </font><br>";
    }
    $innerdir = opendir("{$thisAlbumPath}");
    while (false !== ($innerfile = readdir($innerdir))) {
        //print "$innerfile";
        $thisExt = substr("{$innerfile}", -3);
        if (strtolower($thisExt) == 'jpg' && file_exists($thisThumbnailAlbumPath . "/" . $innerfile) == 0) {
            print "<TR><TD width='300'><font face='arial, helvetica' size='small'>{$thisThumbnailAlbumPath}/{$innerfile}</TD><TD>";
            //print $innerfile . " - " . $album;
            $thisImagePath = $thisAlbumPath . "/" . $innerfile;
            $thisThumbnailPath = $thisThumbnailAlbumPath . "/" . $innerfile;
            print createThumb($thisImagePath, $thisThumbnailPath);
            print "</font></TD></TR>";
        }
    }
}
开发者ID:khanab85,项目名称:InterOlpe,代码行数:20,代码来源:bt.php

示例6: upload

function upload()
{
    global $destFolder, $shouldBeImage, $target_file, $max_file_size, $basedir;
    if (!file_exists($basedir . $destFolder)) {
        mkdir($basedir . $destFolder, 0777, true);
    }
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
        if ($shouldBeImage) {
            createThumb($target_file, $basedir . $destFolder . '/thumbnails');
        }
        $_SESSION['TEMP_UPLOAD'] = $target_file;
        $_SESSION['UPLOAD_MESSAGE'] = 'upload success';
        $_SESSION['UPLOAD_SUCCESS'] = 'true';
    } else {
        if (filesize($target_file) > $max_file_size) {
            $_SESSION['UPLOAD_MESSAGE'] = 'file too large';
        } else {
            $_SESSION['UPLOAD_MESSAGE'] = 'specific error: ' . $_FILES["fileToUpload"]["error"];
        }
    }
}
开发者ID:Jsarnik,项目名称:lightregions,代码行数:21,代码来源:upload.php

示例7: regenVideoThumbs

function regenVideoThumbs($vid)
{
    global $config;
    $err = NULL;
    $duration = getVideoDuration($vid);
    if (!$duration) {
        $err = 'Failed to get video duration! Converted video not found!?';
    }
    $fc = 0;
    $flv = $config['FLVDO_DIR'] . '/' . $vid . '.flv';
    if ($err == '') {
        settype($duration, 'float');
        $timers = array(ceil($duration / 2), ceil($duration / 2), ceil($duration / 3), ceil($duration / 4));
        @mkdir($config['TMP_DIR'] . '/thumbs/' . $vid);
        foreach ($timers as $timer) {
            if ($config['thumbs_tool'] == 'ffmpeg') {
                $cmd = $config['ffmpeg'] . ' -i ' . $flv . ' -f image2 -ss ' . $timer . ' -s ' . $config['img_max_width'] . 'x' . $config['img_max_height'] . ' -vframes 2 -y ' . $config['TMP_DIR'] . '/thumbs/' . $vid . '/%08d.jpg';
            } else {
                $cmd = $config['mplayer'] . ' ' . $flv . ' -ss ' . $timer . ' -nosound -vo jpeg:outdir=' . $config['TMP_DIR'] . '/thumbs/' . $vid . ' -frames 2';
            }
            exec($cmd);
            $tmb = $fc == 0 ? $vid : $fc . '_' . $vid;
            $fd = get_thumb_dir($vid) . '/' . $tmb . '.jpg';
            $ff = $config['TMP_DIR'] . '/thumbs/' . $vid . '/00000002.jpg';
            if (!file_exists($ff)) {
                $ff = $config['TMP_DIR'] . '/thumbs/' . $vid . '/00000001.jpg';
            }
            if (!file_exists($ff)) {
                $ff = $config['BASE_DIR'] . '/images/default.gif';
            }
            createThumb($ff, $fd, $config['img_max_width'], $config['img_max_height']);
            ++$fc;
        }
        delete_directory($config['TMP_DIR'] . '/thumbs/' . $vid);
    }
    return $err;
}
开发者ID:humor-zo,项目名称:chaofan,代码行数:37,代码来源:function_admin.php

示例8: elseif

    } elseif (!in_array($_FILES['image_upload_file']["type"], $allowedImageType)) {
        $output['error'] = "You can only upload JPG, PNG and GIF file";
    } elseif (round($_FILES['image_upload_file']["size"] / 1024) > 4096) {
        $output['error'] = "You can upload file size up to 4 MB";
    } else {
        /*create directory with 777 permission if not exist - start*/
        createDir(IMAGE_SMALL_DIR);
        createDir(IMAGE_MEDIUM_DIR);
        /*create directory with 777 permission if not exist - end*/
        $path[0] = $_FILES['image_upload_file']['tmp_name'];
        $file = pathinfo($_FILES['image_upload_file']['name']);
        $fileType = $file["extension"];
        $desiredExt = 'jpg';
        $fileNameNew = rand(333, 999) . time() . ".{$desiredExt}";
        $path[1] = IMAGE_MEDIUM_DIR . $fileNameNew;
        $path[2] = IMAGE_SMALL_DIR . $fileNameNew;
        //
        list($width, $height, $type, $attr) = getimagesize($_FILES['image_upload_file']['tmp_name']);
        //
        if (createThumb($path[0], $path[1], $fileType, $width, $height, $width)) {
            if (createThumb($path[1], $path[2], "{$desiredExt}", $width, $height, $width)) {
                $output['status'] = TRUE;
                $output['image_medium'] = $path[1];
                $output['image_small'] = $path[2];
            }
        }
    }
    echo json_encode($output);
}
?>
	
开发者ID:shivabt,项目名称:canthonew,代码行数:30,代码来源:image_upload_demo_submit.php

示例9: moveUploadImage

function moveUploadImage($path, $file, $tmpfile, $max)
{
    //upload your image and give it a random name so no conflicts occur
    $rand = rand(1000, 9000);
    $save_path = $path . $rand . $file;
    //prep file for db and gd manipulation
    $bad_char_arr = array(' ', '&', '(', ')', '*', '[', ']', '<', '>', '{', '}');
    $replace_char_arr = array('-', '_', '', '', '', '', '', '', '', '', '');
    $save_path = str_replace($bad_char_arr, $replace_char_arr, $save_path);
    //move the temp file to the proper place
    if (move_uploaded_file($tmpfile, $save_path)) {
        $ext = pathinfo($save_path, PATHINFO_EXTENSION);
        $base = pathinfo($save_path, PATHINFO_FILENAME);
        $dir = pathinfo($save_path, PATHINFO_DIRNAME);
        $base_path = "{$dir}/{$base}";
        copy($save_path, "{$base_path}" . "_thumb" . "." . "{$ext}");
        createThumb("{$base_path}" . "_thumb" . "." . "{$ext}", $ext, 150);
        createThumb("{$base_path}" . "." . "{$ext}", $ext, 640);
        //chmod("$base_path" . "_thumb" . "." . "$ext", 0644);
        //chmod("$base_path" . "." . "$ext", 0644);
        return $save_path;
    }
    unlink($tmpfile);
    return false;
}
开发者ID:gomininggo,项目名称:jTracker,代码行数:25,代码来源:functions.php

示例10: array

    $allowedImageType = array("image/gif", "image/jpeg", "image/pjpeg", "image/png", "image/x-png");
    if ($_FILES['image_upload_file']["error"] > 0) {
        $output['error'] = "Error in File";
    } elseif (!in_array($_FILES['image_upload_file']["type"], $allowedImageType)) {
        $output['error'] = "You can only upload JPG, PNG and GIF file";
    } elseif (round($_FILES['image_upload_file']["size"] / 1024) > 4096) {
        $output['error'] = "You can upload file size up to 4 MB";
    } else {
        /*create directory with 777 permission if not exist - start*/
        createDir(IMAGE_SMALL_DIR);
        createDir(IMAGE_MEDIUM_DIR);
        /*create directory with 777 permission if not exist - end*/
        $path[0] = $_FILES['image_upload_file']['tmp_name'];
        $file = pathinfo($_FILES['image_upload_file']['name']);
        $fileType = $file["extension"];
        $desiredExt = 'jpg';
        $fileNameNew = rand(333, 999) . time() . ".{$desiredExt}";
        $path[1] = IMAGE_MEDIUM_DIR . $fileNameNew;
        $path[2] = IMAGE_SMALL_DIR . $fileNameNew;
        if (createThumb($path[0], $path[1], $fileType, IMAGE_MEDIUM_SIZE, IMAGE_MEDIUM_SIZE, IMAGE_MEDIUM_SIZE)) {
            if (createThumb($path[1], $path[2], "{$desiredExt}", IMAGE_SMALL_SIZE, IMAGE_SMALL_SIZE, IMAGE_SMALL_SIZE)) {
                $output['status'] = TRUE;
                $output['image_medium'] = $path[1];
                $output['image_small'] = $path[2];
            }
        }
    }
    echo json_encode($output);
}
?>
	
开发者ID:paprobag01,项目名称:paprobag-1,代码行数:30,代码来源:image_upload_demo_submit.php

示例11: processNewImage

function processNewImage()
{
    $fullimagePath = $_FILES['myFile']['tmp_name'];
    //print_r ($_FILES);
    $thumbimagePath = "./thumb/thumb.jpg";
    $category = htmlentities($_POST['category'], ENT_QUOTES);
    $description = htmlentities($_POST['description'], ENT_QUOTES);
    if ($category == 'none' && $description == "") {
        print "Incorrect category and/or no description entered.";
        return;
    }
    $info = getimagesize($fullimagePath);
    $ty = $info[2];
    // type
    if ($ty != 2) {
        $error = "incorrect file type given. Please upload a jpg image.";
        print $error;
        return;
    } else {
        createThumb($fullimagePath, $thumbimagePath);
        $fileContents = addslashes(file_get_contents($fullimagePath));
        $thumbContents = addslashes(file_get_contents($thumbimagePath));
        $db = dbConnect();
        if (!$db) {
            print "Error in connecting to database.";
            return;
        } else {
            $query = "insert into myImages (fullImage, category, description, thumbImage)" . " values ('{$fileContents}','{$category}','{$description}','{$thumbContents}');";
            $result = $db->Execute($query);
            if (!$result) {
                $queryError = "error in the query";
                print $queryError;
                return;
            }
        }
    }
}
开发者ID:skduncan,项目名称:image-db,代码行数:37,代码来源:image-db.php

示例12: copy

 // Wurde wirklich eine Datei hochgeladen?
 if (is_uploaded_file($_FILES["image1"]["tmp_name"])) {
     // Gültige Endung? ($ = Am Ende des Dateinamens) (/i = Groß- Kleinschreibung nicht berücksichtigen)
     if (preg_match("/\\." . $allowed_image_filetypes . "\$/i", $_FILES["image1"]["name"])) {
         // Datei auch nicht zu groß
         if ($_FILES["image1"]["size"] <= $max_upload_size) {
             // Alles OK -> Datei kopieren
             //http://www.php.net/manual/en/features.file-upload.php, use basename to preserve filename for multiple uploaded files.... if needed ;)
             //save uploaded source image, do watermark and resize
             if (move_uploaded_file($_FILES["image1"]["tmp_name"], $tm_nlimgpath . "/" . $NL_Imagename1_source)) {
                 //copy source image to tmp image
                 copy($tm_nlimgpath . "/" . $NL_Imagename1_source, $tm_nlimgpath . "/" . $NL_Imagename1_tmp);
                 //create thumb ?!
                 if (${$InputName_ImageResize} == 1 && ${$InputName_ImageResizeSize} > 0) {
                     //save resized image
                     $rs = createThumb($tm_nlimgpath . "/" . $NL_Imagename1_tmp, $tm_nlimgpath . "/" . $NL_Imagename1_resized, ${$InputName_ImageResizeSize}, 95);
                     if ($rs) {
                         //move resized image to tmp image
                         rename($tm_nlimgpath . "/" . $NL_Imagename1_resized, $tm_nlimgpath . "/" . $NL_Imagename1_tmp);
                         $_MAIN_MESSAGE .= "<br>" . sprintf(___("Bildgröße geändert in max. %s px."), ${$InputName_ImageResizeSize});
                     } else {
                         $_MAIN_MESSAGE .= "<br>" . sprintf(___("Fehler beim Ändern der Bildgröße in max. %s px."), ${$InputName_ImageResizeSize});
                     }
                 }
                 #add watermark to image?
                 if (${$InputName_ImageWatermark} == 1) {
                     if (file_exists($watermark_image)) {
                         $wm = watermark($tm_nlimgpath . "/" . $NL_Imagename1_tmp, $tm_nlimgpath . "/" . $NL_Imagename1_watermarked, $watermark_image, 95);
                         if ($wm[0]) {
                             //move resized image to tmp image
                             rename($tm_nlimgpath . "/" . $NL_Imagename1_watermarked, $tm_nlimgpath . "/" . $NL_Imagename1_tmp);
开发者ID:aydancoskun,项目名称:octobercms,代码行数:31,代码来源:nl_upload.inc.php

示例13: getThumb

function getThumb()
{
    global $db, $prefix, $iConfig, $moduleName;
    $pictureId = intval($_GET['pictureid']);
    $thumbsPath = $iConfig['thumbs_path'];
    $uploadPath = $iConfig['upload_path'];
    $thumbsFormat = strtolower($iConfig['thumbs_format']);
    $thumbsRealPath = iPath($thumbsPath);
    if ($pictureId) {
        $picture = $db->sql_fetchrow($db->sql_query('SELECT * FROM ' . $prefix . '_igallery_pictures WHERE picture_id=' . $pictureId . ' LIMIT 0,1'));
        $filename = $picture['picture_file'];
        $pictureType = $picture['picture_type'];
        $albumId = intval($picture['album_id']);
        $album = $db->sql_fetchrow($db->sql_query('SELECT album_title, album_folder FROM ' . $prefix . '_igallery_albums WHERE album_id=\'' . $albumId . '\' LIMIT 0,1'));
        $folderName = $album['album_folder'];
        $info = pathinfo($filename);
        $rawFilename = str_replace($info['extension'], '', $filename);
        if ($pictureType) {
            $thumb = iPath($uploadPath . 'thumbs/' . $rawFilename . $thumbsFormat);
            if (file_exists($thumb)) {
                $thumbPath = $thumb;
            } else {
                createThumb($moduleName, '', $filename, $type = 1);
                $thumbPath = NUKE_BASE_DIR . 'modules/' . $moduleName . '/images/no_image.png';
            }
        } else {
            $thumb = iPath($thumbsPath . $folderName . '/' . $rawFilename . $thumbsFormat);
            if (!file_exists($thumbsRealPath . $folderName)) {
                @mkdir($thumbsRealPath . $folderName);
            }
            if (file_exists($thumb)) {
                $thumbPath = $thumb;
            } else {
                createThumb($moduleName, $folderName, $filename);
                $thumbPath = NUKE_BASE_DIR . 'modules/' . $moduleName . '/images/no_image.png';
            }
        }
    }
    if (!isset($thumbPath) || empty($thumbPath)) {
        $thumbPath = NUKE_BASE_DIR . 'modules/' . $moduleName . '/images/no_image.png';
    }
    if (file_exists($thumbPath) && is_readable($thumbPath)) {
        $info = getimagesize($thumbPath);
        $offset = 3600 * 24 * 60;
        // Set offset to keep in cache for 2 months (thumbs would not really change that much)
        header('Cache-Control: max-age=' . $offset . ', must-revalidate');
        header('Content-type: ' . $info['mime']);
        header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $offset) . ' GMT');
        // check if the browser is sending a $_SERVER['HTTP_IF_MODIFIED_SINCE'] global variable
        if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
            // if the browser has a cached version of this image, send 304
            header('Last-Modified: ' . $_SERVER['HTTP_IF_MODIFIED_SINCE'], true, 304);
            exit;
        }
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($thumbPath)) . ' GMT');
        ob_start();
        readfile($thumbPath);
        //ob_end_flush();
        $outputImage = ob_get_contents();
        //header('Content-length: '.ob_get_length()); //This was causing a loop reloading the picture 'til browser just give up (Google Chrome)
        ob_end_clean();
        echo $outputImage;
    }
    exit;
}
开发者ID:jestrella04,项目名称:iGallery1x,代码行数:65,代码来源:functions.php

示例14: install

    function install() {

      // SET GALLERY OPTIONS HERE
      // -----------------------
      // Set Gallery options by editing this text:

      $options .= '<simpleviewerGallery maxImageWidth="380" maxImageHeight="380" textColor="0x000000" frameColor="0x000000" frameWidth="5" stagePadding="5" thumbnailColumns="2" thumbnailRows="2" navPosition="right" title="OOS [Gallery]" enableRightClickOpen="false" backgroundImagePath="images/gallery.jpg" imagePath="gallery/images/" thumbPath="gallery/thumbs/">';

      // Set showDownloadLinks to true if you want to show a 'Download Image' link as the caption to each image.
      $showDownloadLinks = false;

      // set useCopyResized to true if thumbnails are not being created.
      // This can be due to the imagecopyresampled function being disabled on some servers
      $useCopyResized = false;

      // Set sortImagesByDate to true to sort by date. Otherwise files are sorted by filename.
      $sortImagesByDate = true;

      // Set sortInReverseOrder to true to sort images in reverse order.
      $sortInReverseOrder = true;

      // END OF OPTIONS
      // -----------------------

      $tgdInfo    = getGDversion();
      if ($tgdInfo == 0){
        // print "Note: The GD imaging library was not found on this Server. Thumbnails will not be created. Please contact your web server administrator.<br><br>";
        $error_gdlib = "Note: The GD imaging library was not found on this Server. Thumbnails will not be created. Please contact your web server administrator.";
        $messageStack->add($error_gdlib, 'error');
      }

      if ($tgdInfo < 2){
        // print "Note: The GD imaging library is version ".$tgdInfo." on this server. Thumbnails will be reduced quality. Please contact your web server administrator to upgrade GD version to 2.0.1 or later.<br><br>";
        $error_gdlib = "Note: The GD imaging library is version ".$tgdInfo." on this server. Thumbnails will be reduced quality. Please contact your web server administrator to upgrade GD version to 2.0.1 or later.";
        $messageStack->add($error_gdlib, 'error');
      }

/*
     if ($sortImagesByDate){
       print "Sorting images by date.<br>";
     } else {
       print "Sorting images by filename.<br>";
     }

     if ($sortInReverseOrder){
       print "Sorting images in reverse order.<br><br>";
     } else {
       print "Sorting images in forward order.<br><br>";
     }
*/


      //loop thru images
      $xml = '<?xml version="1.0" encoding="UTF-8" ?>'.$options;
      $folder = opendir(OOS_GALLERY_PATH ."images");
      while($file = readdir($folder)) {
        if ($file == '.' || $file == '..' || $file == 'CVS' || $file == '.svn') continue;

        if ($sortImagesByDate){
          $files[$file] = filemtime(OOS_GALLERY_PATH . "images/$file");
        } else {
          $files[$file] = $file;
        }
      }

      // now sort by date modified
      if ($sortInReverseOrder){
        arsort($files);
      } else {
        asort($files);
      }


      foreach($files as $key => $value) {
        $xml .= '
        <image>';
        $xml .= '<filename>'.$key.'</filename>';

        //add auto captions: 'Image X'
        if ($showDownloadLinks){
          $xml .= '<caption><![CDATA[<A href="images/'.$key.'" target="_blank"><U>Open image in new window</U></A>]]></caption>';
        }
        $xml .= '</image>';

        // print "- Created Image Entry for: $key<br>";

        if (!file_exists(OOS_GALLERY_PATH. "/thumbs/".$key)){
          if (createThumb($key)){
           // print "- Created Thumbnail for: $key<br>";
          }
        }
      }

      closedir($folder);

      $xml .= '</simpleviewerGallery>';

      $file = OOS_ABSOLUTE_PATH . 'gallery.xml';
      if (!$file_handle = fopen($file,"w")) {
        // print "<br>Cannot open XML document: $file<br>";
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:101,代码来源:oos_event_gallery.php

示例15: imagejpeg

                        imagejpeg($newImg, "d:/Websites/myrealtornow.ca/images/" . $matrixid . '_' . $m . ".jpg", 100);
                    }
                    if (file_exists($newname)) {
                        $start = 'd:/websites/myrealtornow.ca/images/' . $matrixid . '_' . $m;
                        if (!file_exists($start . '_sm1.jpg')) {
                            save_resize_image($newname, 475, 350, $ext, '_sm1');
                        }
                        if (!file_exists($start . '_sm2.jpg')) {
                            save_resize_image($newname, 150, 110, $ext, '_sm2');
                        }
                        if (!file_exists($start . '_sm3.jpg')) {
                            save_resize_image($newname, 105, 332, $ext, '_sm3');
                        }
                        save_resize_image($newname, 450, 1200, $ext, '');
                        if (!file_exists($start . '_sm4.jpg')) {
                            createThumb($newname, $ext, '_sm4', 125, 125);
                        }
                        $n = $m + 1;
                        $sql = 'select * from tb_listing_images where imagename="' . $matrixid . '_' . $m . '" and listingid=' . $lid;
                        $res = mysql_query($sql);
                        if (mysql_num_rows($res) == 0) {
                            $sql2 = 'insert into tb_listing_images (listingid,imagename,ext,ordr) values (' . $lid . ',"' . $matrixid . '_' . $m . '","jpg",' . $n . ')';
                            $res = mysql_query($sql2);
                        }
                    }
                }
            }
        }
    }
}
function save_resize_image($file, $height, $width, $ext, $suffix)
开发者ID:Emaren,项目名称:agentpage,代码行数:31,代码来源:newfeed.php


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