@Süleyman hocam teşekkür ederim.
Resmi boyutlandıran uygulamayı şu şekilde ekliyorum.Ancak denedim ben beceremedim.
BOYUTLANDIR.PHP <?php
//--------------------------------
// UFAK RESIM FONKSIYONLARI
//--------------------------------
define( 'THUMBNAIL_IMAGE_MAX_WIDTH', 150 );
define( 'THUMBNAIL_IMAGE_MAX_HEIGHT', 150 );
function generate_image_thumbnail( $source_image_path, $thumbnail_image_path )
{
list( $source_image_width, $source_image_height, $source_image_type ) = getimagesize( $source_image_path );
switch ( $source_image_type )
{
case IMAGETYPE_GIF:
$source_gd_image = imagecreatefromgif( $source_image_path );
break;
case IMAGETYPE_JPEG:
$source_gd_image = imagecreatefromjpeg( $source_image_path );
break;
case IMAGETYPE_PNG:
$source_gd_image = imagecreatefrompng( $source_image_path );
break;
}
if ( $source_gd_image === false )
{
return false;
}
$thumbnail_image_width = THUMBNAIL_IMAGE_MAX_WIDTH;
$thumbnail_image_height = THUMBNAIL_IMAGE_MAX_HEIGHT;
$source_aspect_ratio = $source_image_width / $source_image_height;
$thumbnail_aspect_ratio = $thumbnail_image_width / $thumbnail_image_height;
if ( $source_image_width <= $thumbnail_image_width && $source_image_height <= $thumbnail_image_height )
{
$thumbnail_image_width = $source_image_width;
$thumbnail_image_height = $source_image_height;
}
elseif ( $thumbnail_aspect_ratio > $source_aspect_ratio )
{
$thumbnail_image_width = ( int ) ( $thumbnail_image_height * $source_aspect_ratio );
}
else
{
$thumbnail_image_height = ( int ) ( $thumbnail_image_width / $source_aspect_ratio );
}
$thumbnail_gd_image = imagecreatetruecolor( $thumbnail_image_width, $thumbnail_image_height );
imagecopyresampled( $thumbnail_gd_image, $source_gd_image, 0, 0, 0, 0, $thumbnail_image_width, $thumbnail_image_height, $source_image_width, $source_image_height );
imagejpeg( $thumbnail_gd_image, $thumbnail_image_path, 90 );
imagedestroy( $source_gd_image );
imagedestroy( $thumbnail_gd_image );
return true;
}
//--------------------------------
// DOSYA HAZIRLAMA FONKSIYONLARI VE YUKLEME
//--------------------------------
define( 'UPLOADED_IMAGE_DESTINATION', './resimler/yuklenenler/' );
define( 'THUMBNAIL_IMAGE_DESTINATION', './resimler/ufakresim/' );
function process_image_upload( $field )
{
$temp_image_path = $_FILES[ $field ][ 'tmp_name' ];
$temp_image_name = $_FILES[ $field ][ 'name' ];
list( , , $temp_image_type ) = getimagesize( $temp_image_path );
if ( $temp_image_type === NULL )
{
return false;
}
switch ( $temp_image_type )
{
case IMAGETYPE_GIF:
break;
case IMAGETYPE_JPEG:
break;
case IMAGETYPE_PNG:
break;
default:
return false;
}
$uploaded_image_path = UPLOADED_IMAGE_DESTINATION . $temp_image_name;
move_uploaded_file( $temp_image_path, $uploaded_image_path );
$thumbnail_image_path = THUMBNAIL_IMAGE_DESTINATION . preg_replace( '{\\.[^\\.]+$}', '.jpg', $temp_image_name );
$result = generate_image_thumbnail( $uploaded_image_path, $thumbnail_image_path );
return $result
? array( $uploaded_image_path, $thumbnail_image_path )
: false;
}
//--------------------------------
// SAYFA YAZDIRILIYOR
//--------------------------------
$result = process_image_upload( 'Image1' );
if ( $result === false )
{
echo '<br>Hata Lutfen Yeniden Deneyiniz';
}
else
{
}
?>
Resminiz Yüklendi : <a target="_blank" href="http://site.com/yuklemeler/<?php echo $result[0];?>">Resim Büyük hali Önizlemesi</a>
<br><br>
Kucuk resim basari ile olusturuldu : <a target="_blank" href="http://site.com/yuklemeler/<?php echo $result[1];?>">Küçük Resim Önizlemesi</a>RESIMEKLE.PHP <form action="boyutlandir.php" method="post" enctype="multipart/form-data">
Resim Seçiniz<br>
<input type="file" name="Image1"><br>
<input type="submit" value="Yükle">
</form>
Not : Resim boyutlandırma sayfasını include ile manşet sisteminin yönetim arayüzünde çalıştırıyorum.