Skip to content

Stop telling people the generated image is a PNG - #11

Merged
MarcelloDuarte merged 1 commit into
mainfrom
docs/refresh-model-lists
Jul 31, 2026
Merged

Stop telling people the generated image is a PNG#11
MarcelloDuarte merged 1 commit into
mainfrom
docs/refresh-model-lists

Conversation

@MarcelloDuarte

Copy link
Copy Markdown
Contributor

Found by running v0.15.5 against the live API rather than a stub.

generateImage() works, but the Gemini image models return image/jpeg by default, while every example in the README and provider docs wrote the bytes to output.png / image.png / edited.png. The bytes were fine, the filename was a lie, and anything dispatching on extension would have been misled.

The MIME type is already returned on each image, so the examples now derive the extension from the response instead of assuming:

$extension = str_replace('image/', '', $image['mimeType']);
file_put_contents("output.{$extension}", base64_decode($image['data']));

Live verification of v0.15.5, six checks, all passing: image returned and decodable (image/jpeg 1408x768), aspectRatio/imageSize honoured (2752x1536 for 16:9 at 2K), numberOfImages > 1 throwing, generateImageToFile() writing a valid file, chat working, and effort mapping to a thinking level without error.

Docs only, so no tag is needed.

Verified against the live API: the Gemini image models return image/jpeg by
default, but every example wrote the bytes to a .png file. The MIME type comes
back on each image, so the examples now take the extension from the response
instead of assuming.
@MarcelloDuarte
MarcelloDuarte force-pushed the docs/refresh-model-lists branch from 7127343 to d9a81f0 Compare July 31, 2026 17:25
@MarcelloDuarte
MarcelloDuarte merged commit 456b661 into main Jul 31, 2026
6 checks passed
@MarcelloDuarte
MarcelloDuarte deleted the docs/refresh-model-lists branch July 31, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant