Keyword

K2 Image article resize source image

  • Uzi
  • Uzi's Avatar Topic Author
  • Offline
  • Premium Member
More
6 years 8 months ago #163279 by Uzi
Hello,

I was wondering if its possible to make use of the image resize functionality of K2. The class upload php script for example can actually resize the image before its saves it to the server. Is it possible with a plugin that I can write myself (never done it though) or maybe hack the core code?

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 8 months ago #163315 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 Image article resize source image
Hey there,

What do you want the plugin to do? Extend's K2's image functionality?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Uzi
  • Uzi's Avatar Topic Author
  • Offline
  • Premium Member
More
6 years 8 months ago - 6 years 8 months ago #163323 by Uzi
Replied by Uzi on topic K2 Image article resize source image

Krikor wrote: Hey there,

What do you want the plugin to do? Extend's K2's image functionality?


I basically want to resize the article image so that for example 5mb images gets resized to default 1200px width, and the height will be calculated automatically, aspect ratio = true. This greatly reduces the image source it's file.

K2 makes use of the class.upload php library which has this functionality. I want to alter this upload functionality so the resize is activated.
Last edit: 6 years 8 months ago by Uzi.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 8 months ago #163334 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 Image article resize source image
You have two options,
a) Hack the core, with the consequences that come with this
b) Create a custom plugin which is based on the upload class and completely replaces K2's image function.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Uzi
  • Uzi's Avatar Topic Author
  • Offline
  • Premium Member
More
6 years 8 months ago #163337 by Uzi
Replied by Uzi on topic K2 Image article resize source image
How would i go with the second option. I understand the risks of the first, but hacking the core code is for me easier than to write a plugin, but if you could point me in the right direction?

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 8 months ago #163346 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 Image article resize source image
This is a bit tricky.
A core hack is never recommended and a custom plugin might take hours of development.

In order to get started, have a look at this example K2 plugin.
getk2.org/extend/extensions/90-example-k2-plugin-for-developers

You can also take a look at this.
extensions.joomla.org/extension/econa-for-joomla-articles-and-k2-items/
You need to ask the developer if there is a significant change in the image's size.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum