I’ve integrated the Gravatar third-party libraries with PHP Faker, and it's working as expected. Now, I’m trying to generate a fake user avatar using Gravatar, but I’ve encountered an issue.
Here's how I retrieve the avatar path from the temp directory (/tmp/e3395a721f569696dd6e9509dd20c8bb.jpg
), and it works fine:
$profile_icon_url = $this->faker()->gravatar(sys_get_temp_dir(), 'wavatar');
After that, I set the user’s avatar using the following method:
$user->saveIconFromLocalFile($profile_icon_url);
When trying to see the user profile the avatar is not displayed, and I have the following error in the log file
ELGG.ERROR: ErrorException: imagewebp(/var/data/elgg-6.x.x/5000/5667/profile/5667medium.webp): Failed to open stream: Permission denied in /home/pessek/WEB/elgg-6.0.0/vendor/imagine/imagine/src/Gd/Image.php:648\nStack trace
After investigation
The directory /var/data/elgg-6.x.x/5000/5667/profile/ does not contain a file named 5667medium.webp. It only contains a file named 5667master.jpg
So 5667medium.webp has not been generated.
Could someone help me ?
Regards,
can it be that the cli uses a different user than the webserver?
In your seeding (cli) only a master icon is created. Then on the website when you view a user the thumbnails are created which are needed. If the webserver can write the thumbnail (like it says in the error log) you won't see a thumbnail.
So check the permissions on the dataroot folder.
I found the issue. I was not running the cli as apache user.
Thanks a lot
Do you have sizes configured for your ' open_graph_image'?
check out https://learn.elgg.org/en/stable/guides/events-list.html#other and then the 'entity:<icon_type>:sizes, <entity_type>' event
Thanks ... it works now with configured 'open_graph_image' sizes
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.