junaidbhura / fly-dynamic-image-resizer

Fly Dynamic Image Resizer plugin for WordPress
https://wordpress.org/plugins/fly-dynamic-image-resizer/
MIT License
162 stars 26 forks source link

Need to round image sizes when naming image #10

Closed defaria closed 6 years ago

defaria commented 7 years ago

The name of the image is based on the returned size. However, sometimes the returned size is not an integer. So you ended up with file names such as my_image500x340.333333.jpg. I think rounding up the numbers before naming the image would help.

On another note. I think it's best to have removed image optimization, at least for now. A lot of servers out there won't allow extra php packages to be loaded. I think a third-party request or cdn is best for image optimization.

junaidbhura commented 7 years ago

Hey @defaria thanks for pointing this out. Since all the image sizes are added in explicitly, I'm not sure how the file names get a decimal point?

Can you give me a scenario where this would happen?


Thanks for your thoughts on image optimization :) . I'm glad you thought it was a good idea too!

junaidbhura commented 7 years ago

@defaria Not sure where your previous comment went 😕

But in reply, I think what you've pointed out is an issue, and the plugin should be able to handle this. I'll build this in and update the plugin soon.

Cheers!

defaria commented 7 years ago

Sorry about that. I posted while at work and it went under the wrong git account. So I removed it really quickly, but I guess you still saw it. Anyway, the issue was on my end. I was doing some math calculations to keep images at the right ratio. I had this calculations being done on a separate function and completely forgot about it.

junaidbhura commented 7 years ago

Haha, no worries 😊

I'll build this in anyway, so the plugin handles cases like this correctly!

junaidbhura commented 6 years ago

I've added support to handle this better! https://github.com/junaidbhura/fly-dynamic-image-resizer/commit/19395330050e4f25175103b4c35a191775597a07