pansidong
/***
* 分割图片
*/
public function cut_img(){
$filename = \'site_upload/form_file_forinput/20180313/20180313191121824939294.png\';
$p = 3;
// Get new sizes
list($width, $height) = getimagesize($filename);
$newwidth = $width;
$newheight = floor($height / $p);
$last = $height % $p;
// Load
$source = imagecreatefrompng($filename);
for( $i=0 ; $i< $p; $i++ ){

$_p = $newheight*$i;
if(( $i + 1 ) == $p)
$newheight += $last;
$thumb = ImageCreateTrueColor($newwidth, $newheight);
imagecopyresized( $thumb, $source, 0, 0, 0, $_p, $newwidth, $height, $width, $height);
header(\'Content-type: image/png\');
imagepng( $thumb , "site_upload/form_file_forinput/20180313/t{$i}.png" );
imagedestroy($thumb);
}

echo \'end\';exit;
}

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-11-17
  • 2021-10-16
  • 2021-12-14
  • 2021-11-05
  • 2021-12-29
猜你喜欢
  • 2021-12-16
  • 2022-12-23
  • 2021-08-30
  • 2021-08-15
  • 2021-05-30
  • 2021-06-22
  • 2022-12-23
相关资源
相似解决方案