Imo this is a wrong path  

```php
sprintf('%s/www/custom/feed_%d.jpg', $app['root.path'], $feed->getId());
```
And you could use the temporary filesystem

see https://github.com/romainneutron/Temporary-Filesystem/blob/master/src/Neutron/TemporaryFilesystem/TemporaryFilesystem.php