system/library/image
public function resize ($width = 0, $height = 0, $default = '') {
[...]
$this->image = imagecreatetruecolor($width, $height)
}
This line should be
$this->image = imagecreatetruecolor($new_width, $new_height)
I believe the same error occurs here:
imagefilledrectangle($this->image, 0, 0, $width, $height, $background);
which I believe should be imagefilledrectangle($this->image, 0, 0, $new_width, $new_height, $background);
as well as here at the very end of the method
$this->width = $width;
$this->height = $height;
should be $new_width and $new_height
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
I'm not making things up, this fails. Walk through it for this method call:
$image->resize(300);
what does $height equal when imagecreatetruecolor($width, $height) runs? It will evaluate to 0 and imagecreatetruecolor will fail because you cannot create an image that is zero pixels tall...
The function of resize is to take an image of any size and any aspect ratio and resize it to fixed dimensions, as per admin settings, while maintaining that aspect ratio.
You however believe it should have a different function and thus claim it does not work correctly.
While there are better resize functions which can be written, which can do more magical things, that does not make your assessment any better.
So, eh, no.
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
But you can't.
Don't be an obstinate jackass. My changes to this code is a marked improvement on the current code base, and there is no argument to be made that its not. You should be grateful that people come here and take time to help solve problems in the codebase, not troll with unhelpful two words replies based on your utter ignorance of the topic.
"Eh, no".
It works perfect for me on OC3.0.3.1 - thanksrgbrewer wrote: ↑Sat Aug 24, 2019 11:30 pmThere's actually several problems with this code... here are my revisions that are currently working properly.
https://pastebin.com/2fx4vxA3
Any fool can write code that a computer can understand. Good programmers write code that humans can understand ~ Martin Fowler.
Users browsing this forum: No registered users and 7 guests