class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
more info about the class
class Image { function saveImage($image,$newName, $path, $image_size, $thumb_size) { $newName = str_replace (array("ä", "ö", "ü", "ß", "Ä", "Ö", "Ü", " "), array("ae", "oe", "ue", "ss", "Ae", "Oe", "Ue", "_"), $newName); if(substr($path, strlen($path)-1, 1) != DS) $path .= DS; if(substr($path, 0, 1) != DS) $path = DS . $path; $instance = new Image(); $handle = new Upload($image); if ($handle->uploaded) { $handle->file_new_name_body = $newName; $handle->image_resize = true; $handle->image_x = $image_size; $handle->image_ratio_y = true; $handle->Process(JPATH_ROOT . $path); if ($handle->processed) { echo 'SUCCESS'; $fileNames['image'] = $handle->file_dst_pathname; } else { echo 'error : ' . $handle->error; } //$handle->image_resize = true; //$handle->image_ratio_y = true; //$handle->image_x = $thumb_size; $handle->file_new_name_body = $newName.'_small'; $handle->Process(JPATH_ROOT . $path); if ($handle->processed) { echo 'SUCCESS'; $fileNames['image_small'] = $handle->file_dst_pathname; $handle->Clean(); } else { echo 'error : ' . $handle->error; } return $fileNames; } echo "ERROR"; return null; } }
Das Problem ist, dass es, sobald ich ein resize versuche zu machen, abbricht. Wenn ich nur ein Rename mache, funktioniert es. Kann mir jemand helfen?
Freundliche Grüsse
Tom