PDA

View Full Version : کار با فابل - کمک



amirepsilon
پنج شنبه 23 اسفند 1386, 08:03 صبح
سلام
دوستان کسی آموزش جامع در مورد کار با تصاویر نداره ؟
ممنون میشم عنواین زیر توش باشه :

1. تغییر اندازه تصویر
2. کپی تصویر
3. پاک کردن تصویر
4. تغییر نام تصویر

ممنون http://forum.p30world.com/images/New-smile/N_aggressive%20(39).gif
یا علی

Bahram0110
پنج شنبه 23 اسفند 1386, 09:24 صبح
اینا که فرمودی همشون کار با فایل بودن! به جز آخری

این کد واسه تغییر اندازه عکسه



function jpgresize ($sourcefile, $dest_x, $dest_y, $targetfile, $jpegqual)
{
/* Get the dimensions of the source picture */
$picsize=getimagesize("$sourcefile");
$source_x = $picsize[0];
$source_y = $picsize[1];
$source_id = imageCreateFromJPEG("$sourcefile");
/* Create a new image object (not neccessarily true colour) */

$target_id=imagecreatetruecolor($dest_x, $dest_y);
/* resize the original picture and copy it into the just created image
object. Because of the lack of space I had to wrap the parameters to
several lines. I recommend putting them in one line in order keep your
code clean and readable */

$target_pic=imagecopyresampled($target_id,$source_ id,
0,0,0,0,
$dest_x,$dest_y,
$source_x,$source_y);
/* Create a jpeg with the quality of "$jpegqual" out of the
image object "$target_pic".
This will be saved as $targetfile */

imagejpeg ($target_id,"$targetfile",$jpegqual);
return true;
}
function gifresize ($sourcefile, $dest_x, $dest_y, $targetfile, $jpegqual)
{
/* Get the dimensions of the source picture */
$picsize=getimagesize("$sourcefile");
$source_x = $picsize[0];
$source_y = $picsize[1];
$source_id = imageCreateFromgif("$sourcefile");
/* Create a new image object (not neccessarily true colour) */

$target_id=imagecreatetruecolor($dest_x, $dest_y);
/* resize the original picture and copy it into the just created image
object. Because of the lack of space I had to wrap the parameters to
several lines. I recommend putting them in one line in order keep your
code clean and readable */

$target_pic=imagecopyresampled($target_id,$source_ id,
0,0,0,0,
$dest_x,$dest_y,
$source_x,$source_y);
/* Create a jpeg with the quality of "$jpegqual" out of the
image object "$target_pic".
This will be saved as $targetfile */

imagegif ($target_id,"$targetfile",$jpegqual);
return true;
}
function pngresize ($sourcefile, $dest_x, $dest_y, $targetfile, $jpegqual)
{
/* Get the dimensions of the source picture */
$picsize=getimagesize("$sourcefile");
$source_x = $picsize[0];
$source_y = $picsize[1];
$source_id = imageCreateFrompng("$sourcefile");
/* Create a new image object (not neccessarily true colour) */

$target_id=imagecreatetruecolor($dest_x, $dest_y);
/* resize the original picture and copy it into the just created image
object. Because of the lack of space I had to wrap the parameters to
several lines. I recommend putting them in one line in order keep your
code clean and readable */
$target_pic=imagecopyresampled($target_id,$source_ id,
0,0,0,0,
$dest_x,$dest_y,
$source_x,$source_y);
/* Create a jpeg with the quality of "$jpegqual" out of the
image object "$target_pic".
This will be saved as $targetfile */
imagepng ($target_id,"$targetfile",$jpegqual);
return true;
}


کپی :

copy ( string source, string dest );

تغییر نام :


rename ( string oldname, string newname );