adobe / adobe/stock-api-libphp
A search with SimilarImage raises an exception
- Vorherrschende Sprache
- PHP
- Sterne
- 20
- Forks
- 23
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
# Issue report
## Brief description of issue
Try to search with SimilarImage using code like:
```
$search_params = new SearchParameters();
$search_params->setSimilarImage(true);
$request = new SearchFilesRequest();
$request->setLocale('en-US');
$request->setSearchParams($search_params);
$request->setSimilarImage("myimage.jpg");
$response = $client->searchFilesInitialize($request, $accessToken)->getNextResponse();
```
You will get a StockApi exception with the error message "Image File is not readable".
The exception is raised in HttpClient.php:92, where it checks if `$file` is a readable file. However, `$file` contains the binary content of the image file, not the image name. Just below this code, `$file` is used as the contents of a multipart upload (assuming it contains the content of the image). My guess is the `if (!is_readable($file)) { ... }` block is not needed and is introducing this bug.
## Proposed fix (if applicable)
Remove the `if (!is_readable($file)) { ... }`
Beitragsleitfaden
Rechercherichtung
Beginne bei HttpClient.php ungefähr in Zeile 92 und verfolge die SimilarImage-Anfrage von SearchFilesRequest durch searchFilesInitialize(). Bestätige, ob der Dateiwert binärer Inhalt ist, wenn die Lesbarkeitsprüfung ausgeführt wird. Fertig bedeutet, dass eine SimilarImage-Suche den Multipart-Bildinhalt ohne die Ausnahme "Image File is not readable" übermitteln kann.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- php
- Bereich
- api
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100