Skip to content

Stdlib: ext/gd — imagecreate / imagepng baseline (ext/gd/gd.c parity) #3496

Description

@PurHur

Category

stdlib

Problem

ext/gd image creation API (imagecreate, imagecreatetruecolor, imagepng, imagejpeg, …) is absent. function_exists('imagecreate') → false. Blocks thumbnail pipelines and anything using GD resources; related but not replaced by getimagesize() (#3271).

php-src reference

Repro (failure today)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "var_export(function_exists(\"imagecreate\"));"'
# bool(false)
<?php
$im = imagecreatetruecolor(10, 10);
$white = imagecolorallocate($im, 255, 255, 255);
imagefill($im, 0, 0, $white);
ob_start();
imagepng($im);
$png = ob_get_clean();
imagedestroy($im);
echo strlen($png) > 8 ? 'ok' : 'fail';

Scope (this repo)

Layer Files Notes
VM new ext/gd/ module, lib/VM/Resource.php GD handle Link -lgd in AOT when needed
Docker Docker/dev/ubuntu-22.04/Dockerfile libgd-dev if missing
Tests test/compliance/cases/stdlib/gd_imagecreate.phpt PNG magic bytes
Phase 1 imagecreatetruecolor, imagecolorallocate, imagefill, imagepng, imagedestroy Expand in follow-ups

Done when

  • Repro prints ok on VM in Docker image
  • GD resource type distinct from stream resources
  • ./script/ci-fast.sh --filter gd_imagecreate green
  • Capability matrix row for core GD functions

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions