Identified Images cannot be converted to image due to invalid (?) content
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.7k
- Forks
- 579
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
PLEASE HELP ME CANCEL/CLOSE THIS ISSUE
My original search was incorrect, and this is a duplicate (times about 10).
In this file, 18 images are identified. But the following code cannot convert any images:
$pdf = $parser->parseFile($pdfFile) ;
$images = $pdf->getObjectsByType('XObject', 'Image') ;
foreach ($images AS $imgKey => $pdfImage) {
try {
$image = @imagecreatefromstring($pdfImage->getContent()) ;
} catch (Exception $e) {
$image = false ;
}
if ($image)
printf("Image[$imgKey] converted.\n") ;
else
printf("Image[$imgKey] could not be converted.\n") ;
}
The encoding here seems to be 'FlateDecode' for all images in this file. I did not find any help to lead me to believe this should not work. Is my approach incorrect?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the linked PDF and the shown getObjectsByType('XObject', 'Image') and getContent() calls. Check whether this report is already covered by the duplicate issues referenced in the message; the issue itself requests closure, so no implementation completion condition is provided.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100