- Posts: 8
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- Resized images of K2 item to /media/k2/items/cache/SUBFOLDER
Resized images of K2 item to /media/k2/items/cache/SUBFOLDER
- Cydonian
-
Topic Author
- Offline
- New Member
Less
More
10 years 1 month ago - 10 years 1 month ago #142024
by Cydonian
Resized images of K2 item to /media/k2/items/cache/SUBFOLDER was created by Cydonian
When admin creates a new K2 item with an image, K2 produces 6 different sizes (_Generic.jpg, _XS.jpg, _S.jpg, _M.jpg, _L.jpg, _XL.jpg) of main image (located under /media/k2/items/src/) and put these, 6 different resized images under /media/k2/items/cache folder.
When admin creates a new K2 item with an image, I want K2 to do it in this way:
- produce 6 different sizes of main image (let's say main_image.jpg) as before BUT put each resized image under these, folders:
main_image_Generic.jpg => /media/k2/items/cache/Generic/
main_image_XS.jpg => /media/k2/items/cache/XS/
main_image_S.jpg => /media/k2/items/cache/XS/
main_image_M.jpg => /media/k2/items/cache/M/
main_image_L.jpg => /media/k2/items/cache/L/
main_image_XL.jpg => /media/k2/items/cache/XL/
I need help, which php file(s) control this action under K2 ??
And how to modify it to make K2 do that for resized item images ??
Thanks!
When admin creates a new K2 item with an image, I want K2 to do it in this way:
- produce 6 different sizes of main image (let's say main_image.jpg) as before BUT put each resized image under these, folders:
main_image_Generic.jpg => /media/k2/items/cache/Generic/
main_image_XS.jpg => /media/k2/items/cache/XS/
main_image_S.jpg => /media/k2/items/cache/XS/
main_image_M.jpg => /media/k2/items/cache/M/
main_image_L.jpg => /media/k2/items/cache/L/
main_image_XL.jpg => /media/k2/items/cache/XL/
I need help, which php file(s) control this action under K2 ??
And how to modify it to make K2 do that for resized item images ??
Thanks!
Last edit: 10 years 1 month ago by Cydonian. Reason: correction
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 1 month ago #142029
by Krikor Boghossian
Replied by Krikor Boghossian on topic Resized images of K2 item to /media/k2/items/cache/SUBFOLDER
I am sorry but this cannot be done.
Please Log in or Create an account to join the conversation.
- Cydonian
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 8
10 years 1 month ago #142030
by Cydonian
Replied by Cydonian on topic Resized images of K2 item to /media/k2/items/cache/SUBFOLDER
why not?? everything is possible if you change its code :)
I just want to know which php file under k2 component controls this function...
I just want to know which php file under k2 component controls this function...
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
Less
More
- Posts: 8743
10 years 1 month ago #142042
by Lefteris
Replied by Lefteris on topic Resized images of K2 item to /media/k2/items/cache/SUBFOLDER
@Cydonian
Hacking an extension is a really bad practice.
It's also not that simple as it sounds. The file that generates the images is administrator/components/com_k2/models/item.php. Changing just that will simply break the extension. You will also have to find all the points in K2 ( component, modules and plugins ) where it is fetching the images and also hack them to use the new locations.
Finally keep in mind that hacking the core K2 will have the following results:
1. Lock you out of K2 updates. Every time an update is out you will lose your changes.
2. You will not be able to get support anymore. Don't expect from us ( or any other company doing this ) to provide support on a hacked extension.
3. Lock you out of most K2 extensions. Hacking core K2 files can cause third-party K2 extensions to break.
That's what you need to know. The choice is yours.
Hacking an extension is a really bad practice.
It's also not that simple as it sounds. The file that generates the images is administrator/components/com_k2/models/item.php. Changing just that will simply break the extension. You will also have to find all the points in K2 ( component, modules and plugins ) where it is fetching the images and also hack them to use the new locations.
Finally keep in mind that hacking the core K2 will have the following results:
1. Lock you out of K2 updates. Every time an update is out you will lose your changes.
2. You will not be able to get support anymore. Don't expect from us ( or any other company doing this ) to provide support on a hacked extension.
3. Lock you out of most K2 extensions. Hacking core K2 files can cause third-party K2 extensions to break.
That's what you need to know. The choice is yours.
Please Log in or Create an account to join the conversation.
- Cydonian
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 8
10 years 1 month ago - 10 years 1 month ago #142047
by Cydonian
Replied by Cydonian on topic Resized images of K2 item to /media/k2/items/cache/SUBFOLDER
@Lefteris
Since I won't update K2 any more, it is not a problem for me.
Current K2 is not enough because it can only store 333 items' images (333x6= 1998 resized images) in cache folder when your hosting service (most of hosting companies have the similar limits) has 2000 file limit for one folder.
At the moment, I am already using 6 different subfolders (cache/XL/, cache/L/, cache/M/, cache/S/, cache/XS/, cache/Generic/) each containing 1000 resized images for my 1000 k2 items on my web site and it is working without any problems if you hack the correct files.
If I can find the correct php file and if I can make K2 put each 6 resized images into "cache/XL/, cache/L/, cache/M/, cache/S/, cache/XS/, cache/Generic/" folders when admin creates a new item with an image, then it will be finished.
I saw other K2 users asking for the similar features from K2 developers in the forum but since there is no positive response from the developers yet, users will have to fix K2 component according to their needs, so that is what I am also going to do.
Thanks for the info, I will check "administrator/components/com_k2/models/item.php" file.
Since I won't update K2 any more, it is not a problem for me.
Current K2 is not enough because it can only store 333 items' images (333x6= 1998 resized images) in cache folder when your hosting service (most of hosting companies have the similar limits) has 2000 file limit for one folder.
At the moment, I am already using 6 different subfolders (cache/XL/, cache/L/, cache/M/, cache/S/, cache/XS/, cache/Generic/) each containing 1000 resized images for my 1000 k2 items on my web site and it is working without any problems if you hack the correct files.
If I can find the correct php file and if I can make K2 put each 6 resized images into "cache/XL/, cache/L/, cache/M/, cache/S/, cache/XS/, cache/Generic/" folders when admin creates a new item with an image, then it will be finished.
I saw other K2 users asking for the similar features from K2 developers in the forum but since there is no positive response from the developers yet, users will have to fix K2 component according to their needs, so that is what I am also going to do.
Thanks for the info, I will check "administrator/components/com_k2/models/item.php" file.
Last edit: 10 years 1 month ago by Cydonian.
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- Resized images of K2 item to /media/k2/items/cache/SUBFOLDER