Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function mini($_F, $_DIR, $_W)
- {
- $load = $_F;
- // percorso e nome file
- $name = explode(".", $load);
- //separa nome dall'estensione
- //modifica l'immagine
- $input_image = $load;
- $size = getimagesize( $input_image );
- $thumb_width = $_W;
- $thumb_height = ( int )(( $thumb_width/$size[0] )*$size[1] );
- $thumbnail = ImageCreateTrueColor( $thumb_width, $thumb_height );
- $src_img = ImageCreateFromJPEG( $input_image );
- ImageCopyResampled( $thumbnail, $src_img, 0, 0, 0, 0, $thumb_width, $thumb_height, $size[0], $size[1] );
- ImageDestroy( $src_img );
- //salva l'immagine
- ImageJPEG( $thumbnail, $_DIR.$name[0]."_thumb.jpg" );
- //libera la memoria
- ImageDestroy( $thumbnail );
- }
- //nome file con percorso - cartella di destinazione - largezza di destinazione
- mini("test.jpg","rsz/", 128);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment