0

サイズ変更された新しい画像をここに配置する場所を見つけようとしています。

function createFile($output_filename = null,$imageNewName) {
        if($this->ext == "JPG" OR $this->ext == "JPEG") {
            imageJPEG($this->dst_r, $this->uploaddir.$imageNewName.'.'.$this->ext, $this->quality);
        } elseif($this->ext == "PNG") {
            imagePNG($this->dst_r, $this->uploaddir.$imageNewName.'.'.$this->ext);
        } elseif($this->ext == "GIF") {
            imageGIF($this->dst_r, $this->uploaddir.$imageNewName.'.'.$this->ext);
        }
        $this->output = $this->uploaddir. $imageNewName;

        echo $this->uploaddir. $imageNewName .'.'.$this->ext;
}

function resize($newWidth, $newHeight) {
    $width = imagesx($this->img_r);
    $height = imagesy($this->img_r);

    $newWidth = $newWidth;
    $newHeight = $newHeight;

    $this->dst_r = ImageCreateTrueColor($newWidth, $newHeight);
    imagecopyresampled($this->dst_r, $this->img_r, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
    $this->img_r = $this->dst_r;
    $this->img_h = $newHeight;
    $this->img_w = $newWidth;
}

    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/img/nonfb/';

$fileNameBase  = $_FILES['Filedata']['name'];
$extension = pathinfo($fileNameBase, PATHINFO_EXTENSION);   
$fileNameNEW = $imageNewName . '.' . $extension;

$targetFile =  str_replace('//','/',$targetPath) . $fileNameNEW;
echo 'TARGET=' . $targetFile;

move_uploaded_file ($tempFile, $targetFile);

$image = new Image();
$image->setFile($targetFile);
$image->setUploadDir($targetPath);
$image->resize(50,50);
$image->createFile(md5($tempFile,$fileNameNEW));
$image->flush()

dst_r を現在のイメージとして、img_r をリソース イメージとして取っていることはわかりますが、それらの値を調べるためにエコーを使用する方法がわかりません。私がやろうとしているのは、そのサイズ変更された画像がどこに配置されているかを見つけて、名前を変更できるようにすることです。

どんな助けでも素晴らしいでしょう!

4

1 に答える 1

1

このコードはクラスにあると仮定します。関数の 9 行目と同様にcreateFile、ファイルはおそらく次のパスに存在します。

echo $this->uploaddir. $imageNewName .'.'.$this->ext;
于 2012-05-22T21:50:21.290 に答える