e107 icon indicating copy to clipboard operation
e107 copied to clipboard

Add external avatar file check for missing files

Open rica-carv opened this issue 10 months ago • 2 comments

Motivation and Context

External avatar files, when missing, give this output: Screenshot 2024-04-27 at 11-37-17 SelosPT Screenshot 2024-04-27 at 11-36-55 Gestor de plugins - Instalado - Área do administrador SelosPT

Description

Added code to revert to default avatar image, when external file is missing, output like this: Screenshot 2024-04-27 at 12-52-09 SelosPT Screenshot 2024-04-27 at 12-51-40 Língua - Área do administrador SelosPT

How Has This Been Tested?

Tested in e107 v2.3.3 clean install, Output tested in admin area and in the front end (pics above)

Types of Changes

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Performance enhancement (non-breaking change which improves efficiency)
  • [ ] Code cleanup (non-breaking change which makes code smaller or more readable)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Documentation (a change to man pages or other documentation)

Checklist

rica-carv avatar Apr 27 '24 12:04 rica-carv

Thanks for this. Maybe I'm misreading it, but the file_exists() function in PHP does not work with remote URLs, so I'm not sure how this is working for you. ?

CaMer0n avatar May 10 '24 22:05 CaMer0n

Thanks for this. Maybe I'm misreading it, but the file_exists() function in PHP does not work with remote URLs, so I'm not sure how this is working for you. ?

Sorry, im using localhost, so forgot it's a remote url. Just changed file_exists for fopen for remote url checking

rica-carv avatar May 11 '24 10:05 rica-carv

There's something wrong, because the generic avatar is still not rendered on the front end, and i narrow it down to this line in e_parse_clas.php: $url = $this->createConstants($url, 'mix');

The issue is that the createConstants method renders as the src of avatar image %7Be_IMAGE%7Dgeneric%2Fblank_avatar.jpg when it should be e107_images/generic/blank_avatar.jpg....

rica-carv avatar Jul 05 '24 20:07 rica-carv

Code Climate has analyzed commit 9fa6f1a5 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (80% is the threshold).

This pull request will bring the total coverage in the repository to 38.5% (0.0% change).

View more on Code Climate.

codeclimate[bot] avatar Aug 04 '24 07:08 codeclimate[bot]

Sorry, closing again and reopening another one because i had changes in my main code, not in a branch. Sorry

rica-carv avatar Aug 04 '24 07:08 rica-carv