hemen php.netten kopyala yapıştır geliştiriyorum
upload kısmı basit form açıp php.net/move_upload_file
yapıyosunuz daha sonra
<?php
$im = imagecreatefromgif( 'test.gif' );
// or $im = imagecreatefromjpeg( 'test.jpg' );
$mw = 360; // max width
$mh = 360; // max height
$ow = imagesx( $im );
$oh = imagesy( $im );
if( $ow > $mw || $oh > $mh ) {
if( $ow > $oh ) {
$tnw = $mw;
$tnh = $tnw * $oh / $ow;
} else {
$tnh = $mh;
$tnw = $tnh * $ow / $oh;
}
} else {
// although within size restriction, we still do the copy/resize process
// which can make an animated GIF still
$tnw = $ow;
$tnh = $oh;
}
// the document recommends you to use truecolor to get better result
$imtn = imagecreatetruecolor( $tnw, $tnh );
// if the image has transparent color, we first extract the RGB value of it,
// then use this color to fill the thumbnail image as the background. This color
// is safe to be assigned as the new transparent color later on because it will
// be filtered by imagecopyresize.
$originaltransparentcolor = imagecolortransparent( $im );
if(
$originaltransparentcolor >= 0 // -1 for opaque image
&& $originaltransparentcolor < imagecolorstotal( $im )
// for animated GIF, imagecolortransparent will return a color index larger
// than total colors, in this case the image is treated as opaque ( actually
// it is opaque )
) {
$transparentcolor = imagecolorsforindex( $im, $originaltransparentcolor );
$newtransparentcolor = imagecolorallocate(
$imtn,
$transparentcolor['red'],
$transparentcolor['green'],
$transparentcolor['blue']
);
// for true color image, we must fill the background manually
imagefill( $imtn, 0, 0, $newtransparentcolor );
// assign the transparent color in the thumbnail image
imagecolortransparent( $imtn, $newtransparentcolor );
}
// copy/resize as usual
imagecopyresized( $imtn, $im, 0, 0, 0, 0, $tnw, $tnh, $ow, $oh );
imagegif( $imtn, 'test.thumbnail.gif' );
imagedestroy( $im );
imagedestroy( $imtn );
?>
şu kodu kendinize göre düzenleyin
dosya adresinide mysqle atmak karışık değil.
basit bölümleri atladım çünkü uygulama eklemeyi filan
denemişsiniz az çok bilginiz var sanırsam.