Jump to content
ELFORUM - Forumul electronistilor

PHP crop from center fix value


script22

Recommended Posts

as vrea sa tai din mijloc si sa creez o noua imagine jumatate din cea originala

 

aici am un cod la care am lucrat ceva ore bune da nu merge imi face o imagine neagra si nu stiu dc

 

$fileext = strtolower(substr($file,strrpos($file,".")+1));if($fileext=="jpg" || $fileext=="jpeg" ){$new_image = imagecreatefromjpeg($bulk);$image_save_func = 'ImageJPEG';}else if($fileext=="png"){$new_image = imagecreatefrompng($bulk);$image_save_func = 'ImagePNG';}else {$new_image = imagecreatefromgif($bulk);$image_save_func = 'ImageGIF';}$width = imagesx($new_image);$height = imagesy($new_image);$new_width = $width /2;$new_height = $height /2;$dst_x = 0;$dst_y = 0;$src_x = $new_height/2;$src_y = $new_width /2;$image_c = ImageCreateTrueColor($new_width, $new_height);imagecopyresampled ($image_c, $new_image, $dst_x, $dst_y, $src_x, $src_y, $new_width, $new_height, $height, $width);$image_save_func($image_c, $new_location.$category.$filename_clean);unlink($bulk);
Link to comment
  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

  • script22

    1

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Terms of Use si Guidelines