Reply to Re: work with images

Your name:

Reply:


Posted by NurAzije on 12/29/05 15:26

Thank you very much, I've done it, this is the script:
<?php
$ftp_server="Server";
$ftp_user_name="UserName";
$ftp_user_pass="Password";
$path="Directory_Path_of _Images";
$pathwww="FTP_Directory_Path_of_images";
$mode1="0777";
$mode2="0644";
$quality=70;
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
//list the directory of images
$d = dir($path);
while(false !== ($e = $d->read())){
if(strpos($e,'.jpg')){
// try to chmod $file to 777
$file=$e;
$command1="CHMOD $mode1 $pathwww/$file";
$command2="CHMOD $mode2 $pathwww/$file";
@ftp_site($conn_id, $command1);
$r = imagecreatefromjpeg($path."/".$e);
imagejpeg($r,str_replace('.jpg','.jpg',$e),$quality);
@ftp_site($conn_id, $command2);
echo "Done $e<br>";
}
if(strpos($e,'.gif')){
// try to chmod $file to 777
$file=$e;
$command1="CHMOD $mode1 $pathwww/$file";
$command2="CHMOD $mode2 $pathwww/$file";
@ftp_site($conn_id, $command1);
$r = imagecreatefromgif($path."/".$e);
imagegif($r,str_replace('.gif','.gif',$e),$quality);
@ftp_site($conn_id, $command2);
echo "Done $e<br>";
}
if(strpos($e,'.png')){
// try to chmod $file to 777
$file=$e;
$command1="CHMOD $mode1 $pathwww/$file";
$command2="CHMOD $mode2 $pathwww/$file";
@ftp_site($conn_id, $command1);
$r = imagecreatefrompng($path."/".$e);
imagepng($r,str_replace('.png','.png',$e),$quality);
@ftp_site($conn_id, $command2);
echo "Done $e<br>";
}
}
// close the connection
ftp_close($conn_id);
?>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация