For that i recomend detect the MIME, my 2 cents: function image_get_info($image) { $details = array(); $data = @getimagesize($image); if (is_array($data)){ $types = array( '1' => 'GIF', '2' => 'JPEG', '3' => 'PNG', '4' => 'SWF', '5' => 'PSD', '6' => 'BMP', '7' => 'TIFF', '8' => 'TIFF', '9' => 'JPC', '10' => 'JP2', '11' => 'JPX', '12' => 'JB2', '13' => 'SWC', '14' => 'IFF', '15' => 'WBMP', '16' => 'XBM' ); $type = array_key_exists($data[2], $types) ? $types[$data[2]] : 'Tipo de Imagen No valida o Desconocida'; $details = array('width' => $data[0], 'height' => $data[1], 'type' => $type, 'mime_type' => $data['mime'] ); } return $details; } i cut&paste :P 2006/5/15, Chris <dmagick@xxxxxxxxx>:
Gustav Wiberg wrote: > Hi there! > > When I upload a picture from a form, then I want to create a copy with a > smaller image. > For example: I upload a picture with dimensions 200x150 name 4.jpg. I > also want a copy of this image but with the dimensions 100x75 pixels. > I've tried this below, but I'm missing something I think... :-) > > I'm using PHP 4.x (don't know exactly the vers.nr, but I can search for > it if it is of importance) First of all *run* to this thread and add some security checks to your image uploading: http://marc.theaimsgroup.com/?l=php-general&m=114755779206436&w=2 Secondly, what does or doesn't happen with your code? It looks fine at first glance but do you get an error? What do you expect it to do and what does it actually do? -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- bet0x -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php