is_photo()) { list ($width, $height, $mime_type) = photo::get_file_metadata($item->data_file); if ($width > $max_size || $height > $max_size) { $tempnam = tempnam(TMPPATH, "size"); $tmpfile = $tempnam . "." . pathinfo($item->data_file, PATHINFO_EXTENSION); gallery_graphics::resize( $item->data_file, $tmpfile, array("width" => $max_size, "height" => $max_size, "master" => Image::AUTO), $item); rename($tmpfile, $item->data_file); unlink($tempnam); } } } }