This PHP was originally to the titlepic in the chain image automatically downloaded, I want it to be downloaded automatically abbreviated to a fixed-size image. How should we revise it?
$sqltext = "Select Id,titlepic from {$dbtbpre}_article where titlepic like ' http://% ' ORDER by ID limit 1"; $r = $empire->fetch1 ($sqltext); if ($r) {$path =ecms_path. " Uploads\\pic\\ "; $yname = $path. basename ($r [titlepic]); $filename = '/uploads/pic/'. basename ($r [titlepic]); if (file_exists ($yname) &&filesize ($yname) >0) {echo ($yname. ") already exists
"); File exists//exit (' s: '. FileSize ($yname)); } else {echo ($yname. ")
Down: ". $r [Titlepic]); $string =readfiletext ($r [titlepic]); Writefiletext_n ($yname, $string); Sleep (1); } $sqltext = "Update {$dbtbpre}_article set titlepic= ' $filename ' where id= ' $r [id] '"; Echo ('
'. $sqltext); $empire->query ($sqltext); Sleep (1); Echo
"; } else {//echo "
"; echo "Done"; } db_close (); $empire =null;
Reply content:
This PHP was originally to the titlepic in the chain image automatically downloaded, I want it to be downloaded automatically abbreviated to a fixed-size image. How should we revise it?
$sqltext = "Select Id,titlepic from {$dbtbpre}_article where titlepic like ' http://% ' ORDER by ID limit 1"; $r = $empire->fetch1 ($sqltext); if ($r) {$path =ecms_path. " Uploads\\pic\\ "; $yname = $path. basename ($r [titlepic]); $filename = '/uploads/pic/'. basename ($r [titlepic]); if (file_exists ($yname) &&filesize ($yname) >0) {echo ($yname. ") already exists
"); File exists//exit (' s: '. FileSize ($yname)); } else {echo ($yname. ")
Down: ". $r [Titlepic]); $string =readfiletext ($r [titlepic]); Writefiletext_n ($yname, $string); Sleep (1); } $sqltext = "Update {$dbtbpre}_article set titlepic= ' $filename ' where id= ' $r [id] '"; Echo ('
'. $sqltext); $empire->query ($sqltext); Sleep (1); Echo
"; } else {//echo "
"; echo "Done"; } db_close (); $empire =null;
This is not an imperial CMS, your needs should be to save the remote picture at the same time automatically cut, then write a function added to writefiletext_n inside the line. As for how to crop the picture Google, you can directly use imagecopyresampled, or installed ImageMagick better, this than the GD class library.