بسم الله الرحمن الرحيم
هذه function قمت باضافاتها وظيفتها تصغير الصور من نوع jpeg
ارجو ارائكم اذا كان فيها اخطاء وشكرا لكم
ملاحظات يجب انشاء ملفين
احدهما يحمل اسم pics
والاخر يحمل اسم thumbs
<?
/////////////////////////////////////////////////////////////
//function resize images v .1 \
//coded by Ahmad sh \
//www.palface.com \
//resize jpeg image just \
//made two folder name pics put the \
//picture you want to resize \
//and anthor one name thumbs \
/////////////////////////////////////////////////////////////
///example for use the function
//resize(width,hight);
//------------------------------------------------------------
resize(107,147);
function resize($nx,$ny){
$dir=opendir("pics");
///////////////////////
//
$pics=array();
while($fname=readdir($dir)){
if(preg_match('/[.]jpg$/',$fname))
$pics []= $fname;
}
closedir($dir);
foreach ($pics as $fname );
{
$im=imagecreatefromjpeg("pics/$fname");
$ox=imagesy($im);
$oy=imagesx($im);
$nm = imagecreatetruecolor( $nx, $ny );
imagecopyresized( $nm, $im, 0, 0, 0, 0, $nx, $ny, $ox, $oy );
print("تم تصغير الصوره ل $fname");
imagejpeg( $nm, "thumbs/$fname" );
ob_start();
}
}
?>