{"action":"created","issue":{"url":"https://api.github.com/repos/spatie/laravel-medialibrary/issues/233","repository_url":"https://api.github.com/repos/spatie/laravel-medialibrary","labels_url":"https://api.github.com/repos/spatie/laravel-medialibrary/issues/233/labels{/name}","comments_url":"https://api.github.com/repos/spatie/laravel-medialibrary/issues/233/comments","events_url":"https://api.github.com/repos/spatie/laravel-medialibrary/issues/233/events","html_url":"https://github.com/spatie/laravel-medialibrary/issues/233","id":157528291,"number":233,"title":"Conversions are not generated with custom_path_generator_class","user":{"login":"loranger","id":6014,"avatar_url":"https://avatars.githubusercontent.com/u/6014?v=3","gravatar_id":"","url":"https://api.github.com/users/loranger","html_url":"https://github.com/loranger","followers_url":"https://api.github.com/users/loranger/followers","following_url":"https://api.github.com/users/loranger/following{/other_user}","gists_url":"https://api.github.com/users/loranger/gists{/gist_id}","starred_url":"https://api.github.com/users/loranger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loranger/subscriptions","organizations_url":"https://api.github.com/users/loranger/orgs","repos_url":"https://api.github.com/users/loranger/repos","events_url":"https://api.github.com/users/loranger/events{/privacy}","received_events_url":"https://api.github.com/users/loranger/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-30T16:06:35Z","updated_at":"2016-06-02T08:41:56Z","closed_at":"2016-06-02T08:41:56Z","body":"Hello,\r\n\r\nI use a custom class for my media storage, here it is :\r\n\r\n```php\r\n<?php\r\n\r\nnamespace App\\Services;\r\n\r\nuse Spatie\\MediaLibrary\\PathGenerator\\PathGenerator;\r\nuse Spatie\\MediaLibrary\\Media;\r\n\r\nclass MediaPathGenerator implements PathGenerator\r\n{\r\n\r\n    /**\r\n    * Build the path for a given media id.\r\n    *\r\n    * @param integer $id\r\n    *\r\n    * @return string\r\n    */\r\n    private function getSubPathFromID($id)\r\n    {\r\n        return implode(str_split(substr(sprintf('%05d', $id), -5)), '/') . '/' . $id;\r\n    }\r\n\r\n    /**\r\n     * Get the path for the given media, relative to the root storage path.\r\n     *\r\n     * @param \\Spatie\\MediaLibrary\\Media $media\r\n     *\r\n     * @return string\r\n     */\r\n    public function getPath(Media $media) :string\r\n    {\r\n        return $this->getSubPathFromID($media->id).'/';\r\n    }\r\n\r\n    /**\r\n     * Get the path for conversions of the given media, relative to the root storage path.\r\n     *\r\n     * @param \\Spatie\\MediaLibrary\\Media $media\r\n     *\r\n     * @return string\r\n     */\r\n    public function getPathForConversions(Media $media) :string\r\n    {\r\n        return $this->getSubPathFromID($media->id).'/c/';\r\n    }\r\n}\r\n```\r\n... and it work very well, except for the conversions.\r\n\r\nThe original file is stored at the right place, my model can retrieve the right urls :\r\n\r\n```bash\r\nPsy Shell v0.7.2 (PHP 7.0.7 — cli) by Justin Hileman\r\n>>> \\App\\Link::find(2)->getMedia()[0]->getUrl()\r\n=> \"/media/0/0/0/0/1/1/WrpxLpXq.jpg\"\r\n>>> \\App\\Link::find(2)->getMedia()[0]->getUrl('thumb')\r\n=> \"/media/0/0/0/0/1/1/c/thumb.jpg\"\r\n>>>\r\n```\r\n\r\n... But the thumb.jpg file is never created (and the `c` folder either).\r\n\r\nEven if the regeneration seems correct, the conversions are not created.\r\n\r\n```bash\r\nart medialibrary:regenerate                                             ⏎ master ✱\r\nMedia 1 regenerated\r\nMedia 2 regenerated\r\nMedia 3 regenerated\r\nMedia 4 regenerated\r\n...\r\nMedia 110 regenerated\r\nMedia 111 regenerated\r\nMedia 112 regenerated\r\nAll done!\r\n```\r\n\r\nDid I miss something ?"},"comment":{"url":"https://api.github.com/repos/spatie/laravel-medialibrary/issues/comments/223230897","html_url":"https://github.com/spatie/laravel-medialibrary/issues/233#issuecomment-223230897","issue_url":"https://api.github.com/repos/spatie/laravel-medialibrary/issues/233","id":223230897,"user":{"login":"loranger","id":6014,"avatar_url":"https://avatars.githubusercontent.com/u/6014?v=3","gravatar_id":"","url":"https://api.github.com/users/loranger","html_url":"https://github.com/loranger","followers_url":"https://api.github.com/users/loranger/followers","following_url":"https://api.github.com/users/loranger/following{/other_user}","gists_url":"https://api.github.com/users/loranger/gists{/gist_id}","starred_url":"https://api.github.com/users/loranger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loranger/subscriptions","organizations_url":"https://api.github.com/users/loranger/orgs","repos_url":"https://api.github.com/users/loranger/repos","events_url":"https://api.github.com/users/loranger/events{/privacy}","received_events_url":"https://api.github.com/users/loranger/received_events","type":"User","site_admin":false},"created_at":"2016-06-02T08:41:56Z","updated_at":"2016-06-02T08:41:56Z","body":"Hello,\r\n\r\nThat was it : I did setup a queue worker after implementing medialibrary and did not notice medialibrary automatically uses it whereas my queue is not running as I'm doing tests.\r\n\r\nMy apologies, thank you for your answer.\r\n\r\nBy the way, while implementing my custom path generator, I noticed the documentation is not up-to-date regarding the interface's methods signatures. The implementation now requires any “return type”. I've just [opened a PR](https://github.com/spatie/docs.spatie.be/pull/25) regarding this documentation typo."}}
{"actor":{"display_login":"loranger"}}