Home arrow Forum

Remository Forum

 


121books.org

 
File Size change Kb to MB - 2005/12/25 02:34 Anyone know in which file, and line #, the Fils Size is listed? Actually, I would like to have the default size multiplied by 1024 and then change the Kb to MB. ReMository is already handling decimal points, so that shouldn't be a problem. I've been hunting around in the files but am obviously missing it.
Thanks,
www.121books.org
  | | Sorry, you do not currently have permission to write here.
admin

Karma: 113  
Re:File Size change Kb to MB - 2005/12/27 02:28 You would need to make a few changes in different places, and it is not dead easy, since the size is held as a text string including both the numeric part and the text "Kb". But it could be done. One day Remository may change, but there are a lot of people holding quite small files where Kb is still a better option. Martin Brampton aka Counterpoint
http://aliro.org
http://black-sheep-research.com
  | | Sorry, you do not currently have permission to write here.
121books.org

 
Re:File Size change Kb to MB - 2005/12/28 07:08 I just want invite any of the ReMository users to post thier solution if they have managed to implement this on thier site.
Looking forward to v.3.4
www.121books.org
  | | Sorry, you do not currently have permission to write here.
121books.org

Karma: 0  
Re:File Size change Kb to MB - 2006/06/15 23:20 Anyone out there know which files need to be moded to enable newly added files to show filesize in MB? I tried using the Admin's hints and made a few changes to startdown and remository.php, but no luck. Surely someone has done this to avoid manually changing the filesize field.

Post edited by: 121books.org, at: 2006/06/15 18:21
  | | Sorry, you do not currently have permission to write here.
121books.org

Karma: 0  
Re:File Size change Kb to MB - 2006/06/27 15:23 Recently tried to manually change the file size field on the Admin side. But after a few days everything reverted back to Kb Thought about changing the filesize in MySQL, but this is the same field from the Admin side, so it should have the same result.

Anyway, if the admin comes across this post; please let me know which files I need to mod to make this happen. If this is already implemented or planned in v. 3.4 I can wait. I’m just waiting for the final release version b4 playing with the betas.
  | | Sorry, you do not currently have permission to write here.
tony121

Karma: -2  
Re:File Size change Kb to MB - 2007/07/12 15:10 We recently received a PM about how we implemented this on our site. I’m posting the answer here so it is available for everyone (and as a hint to the developer that ppl may like to see this feature added ).

All of our files are added from the Admin side. We manually overwrite the file size field with the equivalent MB size. If you ever search for missing files, this field will be reset to the KB size (for all of the files). You’ll then need to reset them again, so don’t search for missing files.

This could be done with a daily script that searches and modifies these fields. You could determine where and what to modify in the Remository files, we tried but kept missing something . We ended up using a free app called autohotkey that we already use for a wide range things. In this case; the relevant portion when adding files selects this field, removes the letters and commas, divides it by 1024, writes the result, adds a space, and “MB.” Autohotkey can automate just about anything that can be laid out in a logical order so you don’t have to repeatedly do the same thing.

I know the person who PMd us was looking for a simple mod that would do this automatically. Sorry.
  | | Sorry, you do not currently have permission to write here.
dino

Karma: 0  
Re:File Size change Kb to MB - 2007/07/12 23:45 @ tony121
you're right - I was after some code modification - I didn't realize that it was that sort of complicated. I would like to ask the developer to consider including this in new releases. I know that it might not be a big issue and that he has more important things to fix or add but I still hope he considers it
It just looks weird when you need to download a file that is 50,654.54 in size. Lots of users don't really know the difference between kb and mb - for them it is only a huge file....

Anyway, thanks for your reply tony121, I guess that I wont be changing anything for now - too many files to go through them manually ...

Post edited by: dino, at: 2007/07/12 22:46
  | | Sorry, you do not currently have permission to write here.
admin

Karma: 113  
Re:File Size change Kb to MB - 2007/07/25 16:46 I'm not sure if you're really asking this about older versions. For Remository 3.42 the file size could be altered by changing part of p-classes/remositoryPhysicalFile.php, replacing the method "setData" with:
Code:

      function setData ($filepath$fileid=0$isblob=0$plaintext=0$withid=true) {         $this->fileid $fileid;         $this->isblob $isblob;         $this->plaintext $plaintext;         $this->withid $withid;         $this->proper_name basename($filepath);         $this->file_path $filepath;         if (!$isblob AND !$plaintext AND file_exists($filepath)) {             $this->date date('Y-m-d H:i:s'filemtime($filepath));             $filesize filesize($filepath)/1024;             $this->size = ($filesize 1024) ? number_format($filesize/10241).' MB' number_format($filesize1).' KB';         }     }


It's only the last couple of lines (not counting brackets) that are different. Just shown the whole method for ease of recognition.

If you want everything in MB, then take out the condition. But that wouldn't work well for me, since most PHP files are well under 1 MB!

Post edited by: admin, at: 2007/07/25 15:48
Martin Brampton aka Counterpoint
http://aliro.org
http://black-sheep-research.com
  | | Sorry, you do not currently have permission to write here.
tony121

Karma: -2  
Re:File Size change Kb to MB - 2007/09/08 22:51 The admins suggestin didn't quite do it for me, but this did:

Code:

 if (!$isblob AND !$plaintext AND file_exists $filepath)) {      $this->date date('Y-m-d H:i:s'filemtime($filepath));      $this->size number_format(filesize($filepath)/1024/10242).' MB';



Just add the extra "/1024" and change KB to MB.
I could swear I tried this in the past, oh-well.
  | | Sorry, you do not currently have permission to write here.

Save FM Radio

Login

Subscribe to Premium Support

Get priority support for Remository and Glossary, sign up now for a Premium Support monthly subscription:

Your Remository user name

Or purchase a year's support:

Your Remository user name

Who is Online

Remository welcomes guests and visitors

We have 1 guest online

Real Time Web Analytics