- 
                Notifications
    You must be signed in to change notification settings 
- Fork 8k
AVIF support for getimagesize() and imagecreatefromstring() #7091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Closed
      
      
    
  
     Closed
                    Changes from 37 commits
      Commits
    
    
            Show all changes
          
          
            43 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      729d496
              
                Initial commit before rebase
              
              
                morsssss 9bd126f
              
                Incremental commit
              
              
                morsssss dc51fb1
              
                Incremental commit
              
              
                morsssss 3e38e9a
              
                Change gd includes to quotes instead of angle brackets
              
              
                morsssss e279fe0
              
                Fix includes
              
              
                morsssss 50db465
              
                Add test script and test image
              
              
                morsssss 93dd902
              
                Fix IMAGETYPE_AVIF support
              
              
                cmb69 cdcebf6
              
                Fix failing test case
              
              
                cmb69 67cc00c
              
                Initial commit before rebase
              
              
                morsssss 76680fd
              
                Incremental commit
              
              
                morsssss 7e08fe6
              
                Change gd includes to quotes instead of angle brackets
              
              
                morsssss 452ebce
              
                Fix includes
              
              
                morsssss 504c50f
              
                Fix IMAGETYPE_AVIF support
              
              
                cmb69 cae634c
              
                Remove AVIF tests from travis and azure; add to cirrus
              
              
                morsssss 0f35858
              
                Remove avif from a few more spots in test configs
              
              
                morsssss 580b3ad
              
                Removed libavif-dev package from azure
              
              
                morsssss cb46c53
              
                Install libavif in freebsd
              
              
                morsssss f88c2b1
              
                Fixes from code review
              
              
                morsssss 5644814
              
                Newline between test output and expected output
              
              
                morsssss 2c44c20
              
                AVIF support in getimagesize()
              
              
                morsssss 7601270
              
                Rename php_little2bigendian() => php_ntohl()
              
              
                morsssss 6a58495
              
                Remove unnecessary comment
              
              
                morsssss 1d0d4a8
              
                Working support for AVIF in imagecreatefromstring()
              
              
                morsssss 06d2a09
              
                Move php_gd_image_reader and php_is_image_avif()
              
              
                morsssss 2e71d61
              
                Add tests and test images
              
              
                morsssss 86a5aa1
              
                data => ZSTR_VAL(data)
              
              
                morsssss c523014
              
                Removed unnecessary spacing
              
              
                morsssss 66f731c
              
                Update expected test results
              
              
                morsssss 80ac6b0
              
                fix for webp detection
              
              
                morsssss 8755426
              
                correct number of expected array elements in test results
              
              
                morsssss 7a715ec
              
                Specify type in php_ntohl() param
              
              
                morsssss 7e64a09
              
                Fully initialize each php_gd_image_reader
              
              
                morsssss 46fa3db
              
                Fix indents
              
              
                morsssss 79bab8f
              
                Fixing more indents
              
              
                morsssss d9931a4
              
                Move up checking for AVIF
              
              
                morsssss a13e98d
              
                Use memory stream instead of php_image_reader
              
              
                morsssss 505e4b5
              
                Merge branch 'master' into getimagetype
              
              
                morsssss 2ff585b
              
                Improvements to streams
              
              
                morsssss dc8e549
              
                really handling streams properly this time
              
              
                morsssss 85d2306
              
                More compact php_handle_avif()
              
              
                morsssss 7689889
              
                Use bool, not int
              
              
                morsssss 54907d0
              
                Code review style changes
              
              
                morsssss 11bef5c
              
                Add indents
              
              
                morsssss File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| --TEST-- | ||
| imagecreatefromstring() - AVIF format | ||
| --EXTENSIONS-- | ||
| gd | ||
| --SKIPIF-- | ||
| <?php | ||
| if (!(imagetypes() & IMG_AVIF)) { | ||
| die('skip AVIF support required'); | ||
| } | ||
| ?> | ||
| --FILE-- | ||
| <?php | ||
| echo "Reading image whose major brand is 'avif':\n"; | ||
| $im = imagecreatefromstring(file_get_contents(__DIR__ . '/imagecreatefromstring_major_brand.avif')); | ||
| var_dump(imagesx($im)); | ||
| var_dump(imagesy($im)); | ||
|  | ||
| echo "Reading image with a compatible brand that's 'avif':\n"; | ||
| $im = imagecreatefromstring(file_get_contents(__DIR__ . '/imagecreatefromstring_compatible_brand.avif')); | ||
| var_dump(imagesx($im)); | ||
| var_dump(imagesy($im)); | ||
| ?> | ||
| --EXPECT-- | ||
| Reading image whose major brand is 'avif': | ||
| int(250) | ||
| int(375) | ||
| Reading image with a compatible brand that's 'avif': | ||
| int(480) | ||
| int(270) | 
            Binary file not shown.
          
    
            Binary file not shown.
          
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.