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

golubovicm created an issue. See original summary.

cilefen’s picture

Title: Second parameter is wrong. » Second parameter to image_style_url() is a URI not a path
stefan.r’s picture

The 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"

amit0212’s picture

The 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