Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add webp to images support #6271

Merged
merged 4 commits into from
May 21, 2024

Conversation

albertlast
Copy link
Collaborator

@albertlast albertlast commented Sep 26, 2020

Add support for the webp image format,
since imagetype stuff on php side is used,
the needed php version is 5.6.26 or 7.0.10 (we are on 5.4.0).
https://www.php.net/manual/en/image.constants.php

Could handle this in some ways:
raise the min version (would be the right way).

Do not add this or
do some version checks.

Since both last idea are stupid i guess we will take one of this?

require php 5.6.26 or 7.0.10

Signed-off-by: albertlast [email protected]
@Oldiesmann
Copy link
Contributor

Considering PHP 5.4 has been EOL for 5 years now I don't see why we can't bump the min version to 5.6 at this point. Even WordPress' stats show very little usage for PHP 5.4 and 5.5 (just 4% of those reporting info to them, compared to 12.8% for 5.6).

@MissAllSunday
Copy link
Contributor

Is there any particular reason to add this image format? is there a request on simplemachines.org for it? perhaps some benefits?

@albertlast
Copy link
Collaborator Author

@MissAllSunday
Copy link
Contributor

None of those links declares webp as the new image standard and this requires us to either bump the min PHP version (something that is not planned at the moment) or add extra checks which adds non needed complexity.

@albertlast
Copy link
Collaborator Author

albertlast commented Dec 15, 2020 via email

@MissAllSunday
Copy link
Contributor

I don't think there is an image standard, webp is just the format google is pushing.

Nevertheless, the required changes overshadows the benefits. Instead I would suggest to change this PR to unify all the $allowedTypes arrays into a single $context key so mod authors can add any format they want.

@albertlast
Copy link
Collaborator Author

the benefits are that we supporting what the most broads needs and
we redurce the complexity by removing old stuff.

The last php raise was in 2017 where 5.3 got dropped,
which is 3 years after eol: https://www.php.net/eol.php

based on this, we had to raise php version to 5.6,
when you personal like to had the old version than is your personal problem but not the problem of the project.

@MissAllSunday
Copy link
Contributor

Its not my personal choice, never has been.

@albertlast
Copy link
Collaborator Author

Since smf 2.0.17 support php 7.2 and with this a migration path exists between 3 php version when i take php 7.0 as baseline,
2.0.18 could possible support php 7.4 which get us to 5 php version overlapping with 2.1
get me to the point that i see no technical reason here.

On the other hand we waist out time with version checks and workaround to support old stuff.

@MissAllSunday
Copy link
Contributor

Then help me out with a serious proposal, expose usage data for PHP versions, specially among shared hostings. The more data we have the more we can push towards changing the min PHP version.

And by serious I really mean a serious proposal and not just posting a couple of links and rant about how its our fault. I alone can't make the decision.

@albertlast
Copy link
Collaborator Author

no i make not your job.
you hurt yourself by supporting this amount of php version and
ask me to give your reason to stop with this.

The shared hoster are not the problem of this project.

the admin had the option to change the hoster,
to stay with 2.0.x or to get in touch with hoster.

The supported php version is hugh enough even with 7.0,
since the next version of php is comming 8.0 and many will follow in the live time of 2.1.x

@m4z
Copy link

m4z commented Dec 17, 2020

https://www.php.net/usage.php (apparently from 2013) leads to netcraft (2013) and w3techs (current), and the latter numbers aren't very beautiful: 40% (or 32%, according to the following link 😕 ) of PHP sites still use 5.x!

But: of the sites using 5.x,

  • 50% use 5.6 (so 20% or 16% of all PHP sites),
  • 9% use 5.5 (4% or 3% of all),
  • 16% use 5.4 (6% or 5% of all).

Wordpress shows slightly different numbers:

  • 12.1% total for 5.6,
  • 1.3% total for 5.5,
  • 2.5% total for 5.4.

AFAIK, the SMF detailed stats are broken, so we can't know our real numbers.

The detailed market reports of various sites aren't available for free.

@albertlast
Copy link
Collaborator Author

using doesn't mean they had no others to choose.

and still the question if smf had the dev power to support sutch amount of php versions.

@albertlast
Copy link
Collaborator Author

@MissAllSunday requesting reopening of this pr since #6501 got merged

@MissAllSunday
Copy link
Contributor

MissAllSunday commented Feb 8, 2021

Instead I would suggest to change this PR to unify all the $allowedTypes arrays into a single $context key so mod authors can add any format they want.

And the min was raised to 5.6.0

https://xkcd.com/927/

@albertlast
Copy link
Collaborator Author

5.6.40 is the last version and 5.6.26 would be a good meet in the middle.

@sbulen
Copy link
Contributor

sbulen commented Feb 27, 2021

Note that IMAGETYPE_WEBP is only defined in php 7.1+.

@albertlast
Copy link
Collaborator Author

@sbulen since thed idea to implement webp again, this pr exists closed for this topic

@jdarwood007
Copy link
Member

@albertlast Since @sbulen has committed to supporting it. Would you want to get this up to sync with current code and a viable PR ready?

@jdarwood007 jdarwood007 reopened this Aug 19, 2023
@albertlast
Copy link
Collaborator Author

@jdarwood007 pr is updated now, feel free to test the code

@DiegoAndresCortes
Copy link
Member

DiegoAndresCortes commented Aug 19, 2023

What about certain file inputs like this one:

<div id="avatar_upload">
', $context['member']['avatar']['choice'] == 'upload' ? '<div class="edit_avatar_img"><img src="' . $context['member']['avatar']['href'] . '" alt=""></div>' : '', '
<input type="file" size="44" name="attachment" id="avatar_upload_box" value="" onchange="readfromUpload(this)" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'upload\');" accept="image/gif, image/jpeg, image/jpg, image/png">', template_max_size('upload'), '
', (!empty($context['member']['avatar']['id_attach']) ? '<br><img src="' . $context['member']['avatar']['href'] . (strpos($context['member']['avatar']['href'], '?') === false ? '?' : '&amp;') . 'time=' . time() . '" alt="" id="attached_image"><input type="hidden" name="id_attach" value="' . $context['member']['avatar']['id_attach'] . '">' : ''), '
</div>';

Should they be updated to accept="image/*" ?

Actually it seems to be the only one.

@jdarwood007 jdarwood007 added this to the 2.1.6 milestone Aug 19, 2023
@Sesquipedalian Sesquipedalian modified the milestones: 2.1.6, 2.1.5 May 11, 2024
@Sesquipedalian Sesquipedalian merged commit c825dd1 into SimpleMachines:release-2.1 May 21, 2024
8 checks passed
Sesquipedalian added a commit to Sesquipedalian/SMF that referenced this pull request Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants