Beispiel #1
0
function displayTestWatermarkImage(array $test_data_set)
{
    foreach ($test_data_set as $image_ext => $items) {
        echo '<h3><a href="' . $items['source_image_path'] . '">' . $image_ext . '</a><img src="' . $items['source_image_path'] . '" alt="" class="thumbnail"></h3>' . "\n";
        $Image = new \Rundiz\Image\Drivers\Gd($items['source_image_path']);
        $main_save_file_name = '../processed-images/rundiz-gd-image-watermarkImage-testpage-source-' . strtolower($image_ext);
        foreach ($items['watermark_exts'] as $wm_ext) {
            $wmext_save_file_name = $main_save_file_name . '-watermark-' . $wm_ext;
            $watermark_image_path = '../source-images/watermark.' . $wm_ext;
            echo '<h4>watermark from <a href="' . $watermark_image_path . '">' . $wm_ext . '</a><img src="' . $watermark_image_path . '" alt="" class="thumbnail"></h4>' . "\n";
            foreach ($items['watermark_positions'] as $wm_pos) {
                $save_file_name = $wmext_save_file_name . '-position-' . $wm_pos[0] . ',' . $wm_pos[1];
                echo 'position ' . $wm_pos[0] . ', ' . $wm_pos[1] . '<br>';
                foreach ($items['watermark_exts'] as $save_ext) {
                    $Image->watermarkImage($watermark_image_path, $wm_pos[0], $wm_pos[1]);
                    $Image->save($save_file_name . '.' . $save_ext);
                    $Image->clear();
                    echo '<a href="' . $save_file_name . '.' . $save_ext . '">save as ' . $save_ext . '</a><img src="' . $save_file_name . '.' . $save_ext . '" alt="" class="thumbnail"> ';
                }
                echo '<br>' . "\n";
                unset($save_file_name);
            }
            unset($watermark_image_path, $wmext_save_file_name, $wm_pos);
        }
        unset($Image, $main_save_file_name);
    }
}
Beispiel #2
0
$Image->save($file_name);
$Image->clear();
echo '<a href="' . $file_name . '">' . $file_ext . ' (rotate &gt; resize &gt; crop)</a><img src="' . $file_name . '" alt="" class="thumbnail"><br> ';
$file_name = '../processed-images/rundiz-gd-image-crop-900x900-crop-600x600-crop-' . $crop_width . 'x' . $crop_height . '-crop-400x400-sourcejpg.' . $file_ext;
$Image->crop(900, 900);
$Image->crop(600, 600);
$Image->crop($crop_width, $crop_height);
$Image->crop(400, 400);
$Image->save($file_name);
$Image->clear();
echo '<a href="' . $file_name . '">' . $file_ext . ' (crop &gt; crop &gt; crop &gt; crop)</a><img src="' . $file_name . '" alt="" class="thumbnail"><br> ';
$file_name = '../processed-images/rundiz-gd-image' . '-rotate-' . $rotate . '-resize-' . $resize_w . 'x' . $resize_h . '-crop-' . $crop_width . 'x' . $crop_height . '-watermarkimage-right,bottom-sourcejpg.' . $file_ext;
$Image->rotate($rotate);
$Image->resizeNoRatio($resize_w, $resize_h);
$Image->crop($crop_width, $crop_height);
$Image->watermarkImage('../source-images/watermark.png', 'right', 'bottom');
$Image->save($file_name);
$Image->clear();
echo '<a href="' . $file_name . '">' . $file_ext . ' (rotate &gt; resize &gt; crop &gt; watermark image)</a><img src="' . $file_name . '" alt="" class="thumbnail"><br> ';
$file_name = '../processed-images/rundiz-gd-image' . '-rotate-' . $rotate . '-resize-' . $resize_w . 'x' . $resize_h . '-crop-' . $crop_width . 'x' . $crop_height . '-watermarktext-right,bottom-sourcejpg.' . $file_ext;
$Image->rotate($rotate);
$Image->resizeNoRatio($resize_w, $resize_h);
$Image->crop($crop_width, $crop_height);
$Image->watermarkText('Rundiz watermark สั้น ญู ให้ ทดสอบสระ.', '../source-images/cschatthai.ttf', 'right', 'bottom', 13);
$Image->save($file_name);
$Image->clear();
echo '<a href="' . $file_name . '">' . $file_ext . ' (rotate &gt; resize &gt; crop &gt; watermark text)</a><img src="' . $file_name . '" alt="" class="thumbnail"><br> ';
unset($file_name, $Image);
// -------------------------------------------------------------------------------------------------------------------
?>