[menu][解除]
[更新][help]
[次頁]
3Fe%3D130" >blognplusの画像登録時にリサイズを行う
  • 画像をリサイズして生成したサムネイルをブラウザに表示させる方法



  • $error = blogn_mod_db_file_add($user_id, $file_name, $comment);
    @chmod($dest,0666);
    // 最大サイズを超える画像をリサイズする
    if ($size = @getimagesize($dest)) {
    if ($size[0] > BLOGN_MAXWIDTH || $size[1] > BLOGN_MAXHEIGHT) {
    $ratio1 = BLOGN_MAXWIDTH / $size[0];
    $ratio2 = BLOGN_MAXHEIGHT / $size[1];
    if ($ratio1 $ratio = $ratio1;
    }else{
    $ratio = $ratio2;
    }
    $rwidth = round($size[0] * $ratio);
    $rheight = round($size[1] * $ratio);
    $file_type = strtolower(end(explode('.', $dest)));
    if ($file_type === "jpg" || $file_type === "jpeg") {
    $in = ImageCreateFromJPEG($dest);
    $out = ImageCreateTrueColor($rwidth, $rheight);
    ImageCopyResampled($out, $in, 0, 0, 0, 0, $rwidth, $rheight, $size[0], $size[1]);
    ImageJPEG($out, $dest, 100);
    } elseif ($file_type === "gif") {
    $in = ImageCreateFromGIF($dest);
    $out = ImageCreateTrueColor($rwidth, $rheight);
    ImageCopyResampled($out, $in, 0, 0, 0, 0, $rwidth, $rheight, $size[0], $size[1]);
    ImageGIF($out, $dest, 100);
    } elseif ($file_type === "png") {
    $in = ImageCreateFromPNG($dest);
    $out = ImageCreateTrueColor($rwidth, $rheight);
    ImageCopyResampled($out, $in, 0, 0, 0, 0, $rwidth, $rheight, $size[0], $size[1]);
    imagealphablending($out, false);
    imagesavealpha($out, true);
    ImagePNG($out, $dest, 9);
    } else {
    return;
    }
    ImageDestroy($in);
    ImageDestroy($out);
    }
    }



    | http://freeside.skr.jp/blognplus/index.php?e=8 |
    | ブログ::BlognPlus | 04:47 PM | comments (0) | trackback (0) |

    -->

    2014/08/04 (月)
    PDFファイルのアップロード
    author : 管理者

    [次頁](31 p)
    参考↓Nogateでパラメータ化されたURL
    http://freeside.skr.jp/cgi/nogate/n.cgi?MoN=g&UoN=freeside%2Eskr%2Ejp%2Fgraphics%2F%2E%2E%2Fhina%2F%2E%2E%2Fhina%2F%2E%2E%2Fhina%2F%2E%2E%2Fgraphics%2F%2E%2E%2Fblognplus%2Findex%2Ephp ]
    imode型ポップアップ表示 ]
    コピーアンドペーストして上記のようにHTMLのA linkパラメータに使用すればimode用ページアドレスとして使えます.
    (化けているわけではありません:p)
    また、imode型ポップアップ表示の際、川原 千種さんのiModeSSを使用させて頂いております。