Elxis CMS Forum

Support => General => Topic started by: armpouniotis on April 26, 2023, 14:41:43

Title: About image folders
Post by: armpouniotis on April 26, 2023, 14:41:43
hi there !
I have an online newspaper, and I have noticed this:
Everytime I am uploading an image to an article, the system uploads this image to a folder named "articles1".
After a few weeks, the system creates some other folders named "articles2", "articles3", "articles4" etc.
Now, it has reached "articles200", and it doesn't create other folders.
Since "articles200" is very "heavy" with lots of images, is it possible to fix it ?
I think it should continue create more other folder like "articles201", "articles202", "articles203" etc

Any help will be appreciated
Christos
Title: Re: About image folders
Post by: datahell on April 26, 2023, 22:18:04
Hmm, you reached folder 200, interesting... There are 300 images in each folder, so you have at least 60.000 images... You should have mentioned this issue in Elxis 5.4 requests topic, we would have already a solution now for this.
I write it in TODO list for the next Elxlis 5.4 release. Till then, if you want, do the following to solve the problem temporary.

Open file: components/com_content/controllers/base.php

Change lines 682 - 696 from this:

if (is_dir($base.'articles20/')) {
   $nums = array(150, 100, 80, 60, 40, 20);
   foreach($nums as $num) {
      if (is_dir($base.'articles'.$num.'/')) {
         $start = $num;
         $last = $num + 20;
         if ($num == 100) {
            $last = 150;
         } else if ($num == 150) {
            $last = 200;
         }
         break;
      }
   }
}

To this:

if (is_dir($base.'articles20/')) {
   $nums = array(250, 200, 150, 100, 80, 60, 40, 20);
   foreach($nums as $num) {
      if (is_dir($base.'articles'.$num.'/')) {
         $start = $num;
         $last = $num + 20;
         if ($num == 100) {
            $last = 150;
         } else if ($num == 150) {
            $last = 200;
         } else if ($num == 200) {
            $last = 250;
         } else if ($num == 250) {
            $last = 300;
         }
         break;
      }
   }
}

The change above will enable the creation of folders from 201 to 300 and you will be able to upload 30.000 more images...
Title: Re: About image folders
Post by: armpouniotis on April 27, 2023, 14:20:50
It works !
thank you datahell !

P.S. So If I continue the code like this:

         else if ($num == 250) {
            $last = 300;
         }else if ($num == 300) {
            $last = 400;
         }

the directories will count to 400... Right ?
Title: Re: About image folders
Post by: datahell on April 27, 2023, 20:46:24
Yes, but you must also put the numbers into the array. However don't do anything as whatever you do will be overwritten in a next update. This is a temporary solution. I noted this problem and it will be fixed permanently with a better system. When ever you see an updated version of Elxis 5.4 available do the update.
Title: Re: About image folders
Post by: armpouniotis on April 27, 2023, 23:31:35
okey !

Thank you for this solution, I am waiting for the next update !

Christos
Title: Re: About image folders
Post by: datahell on April 29, 2023, 21:05:42
Done! Update to Elxis 5.4 Calypso rev2517. The new system is faster and doesn't have limits.

For more click here (https://forum.elxis.org/index.php?topic=9322.msg59019#msg59019)