Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
API page: https://api.drupal.org/api/drupal/modules!image!image.module/function/im...
Enter a descriptive title (above) relating to function image_style_url, then describe the problem you have found:
Second parameter is not $path as this page says, but $uri.
Comments
Comment #2
cilefen CreditAttribution: cilefen commentedComment #3
stefan.r CreditAttribution: stefan.r commentedThe documentation already states "The passed-in $path variable can be either a relative path or a full URI.", but just to make that clearer we could adjust the param description to say "The path or URI to the image" rather than "The path to the image"
Comment #4
amit0212 CreditAttribution: amit0212 as a volunteer and commentedThe parameter $path is actually a uri in the form public://path/to/file
To get a proper uri you can use file_build_uri() or you can find it in the uri column of the file_managed table.
If you don't use a uri and only use a path (e.g. "path/to/file"), you'll receive a php fatal error: Call to a member function getDirectoryPath() on a non-object