Post by VanioBoy » Sat Jun 26, 2021 6:02 pm

Hello everyone, I need a little help!

I have a problem with the background of some .png images. They are automatically uploaded from another site without a background. When resized, their background is black.
At the moment, the option is to remake all the photos, but that would take days.
How do I fix the problem?

The file: system / library / image.php has not been changed!
Last edited by VanioBoy on Mon Jun 28, 2021 3:00 pm, edited 3 times in total.

New member

Posts

Joined
Wed Nov 09, 2016 5:52 pm


Post by straightlight » Mon Jun 28, 2021 4:27 am

URL.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by paulfeakins » Mon Jun 28, 2021 5:59 pm

straightlight wrote:
Mon Jun 28, 2021 4:27 am
URL.
Just writing "URL." is unhelpful and unnecessary.

However, this question has been asked multiple times:
viewtopic.php?t=182332
viewtopic.php?t=130967
viewtopic.php?t=8818
And more.

So please always search before asking.

If none of those (and any others you find) solve your problem then you should pay a developer such as ourselves or post a job in the Commercial Support Forum.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by straightlight » Mon Jun 28, 2021 6:38 pm

paulfeakins wrote:
Mon Jun 28, 2021 5:59 pm
straightlight wrote:
Mon Jun 28, 2021 4:27 am
URL.
Just writing "URL." is unhelpful and unnecessary.

However, this question has been asked multiple times:
viewtopic.php?t=182332
viewtopic.php?t=130967
viewtopic.php?t=8818
And more.

So please always search before asking.

If none of those (and any others you find) solve your problem then you should pay a developer such as ourselves or post a job in the Commercial Support Forum.
Based on opinions.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by paulfeakins » Mon Jun 28, 2021 6:49 pm

straightlight wrote:
Mon Jun 28, 2021 6:38 pm
Based on opinions.
That comment makes absolutely no sense.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by VanioBoy » Mon Jun 28, 2021 10:30 pm

Hi, I checked the links, two of them are not on my question, and the third has no solution to the problem.
Thanks for joining though

I understand where the problem comes from, but I can't fix it. Photos with a black background are uploaded with the .jpg extension, but the photos are actually .png.

New member

Posts

Joined
Wed Nov 09, 2016 5:52 pm


Post by VanioBoy » Tue Jun 29, 2021 10:51 pm

How to make this code run for .png and .jpg

Code: Select all

		if ($this->mime == 'image/png') {
			imagealphablending($this->image, false);
			imagesavealpha($this->image, true);
			$background = imagecolorallocatealpha($this->image, 255, 255, 255, 127);
			imagecolortransparent($this->image, $background);
		} else {
			$background = imagecolorallocate($this->image, 255, 255, 255);
		}

New member

Posts

Joined
Wed Nov 09, 2016 5:52 pm

Who is online

Users browsing this forum: No registered users and 236 guests