Post by vincent_angbt » Sun Jun 19, 2016 10:55 pm

space.png

space.png (48.62 KiB) Viewed 5828 times

as we can see, the image manager will show there is space add to the number character 15.
if the image name more than 15, then it will auto add white space and cause the og issue.

how can we solve this beside make the image name shorter than 15 character.

New member

Posts

Joined
Tue Dec 17, 2013 11:35 am

Post by ojars26 » Mon Jun 20, 2016 3:39 am

I use this and it works for me! No-spaces in filename or directory

Attachments

No-space in file or directory name "filemanager"


User avatar
Newbie

Posts

Joined
Wed May 25, 2016 5:04 am

Post by vincent_angbt » Mon Jun 20, 2016 8:28 am

ojars26 wrote:I use this and it works for me! No-spaces in filename or directory
Hi, can give the link as my version is 2.0.1.2.

Thanks

New member

Posts

Joined
Tue Dec 17, 2013 11:35 am

Post by ojars26 » Mon Jun 20, 2016 12:49 pm

It should work on all versions. 2.0.0.0 - 2.2.0.0

Attachments


User avatar
Newbie

Posts

Joined
Wed May 25, 2016 5:04 am

Post by vincent_angbt » Tue Jun 21, 2016 5:04 pm

Hi, its work...

New member

Posts

Joined
Tue Dec 17, 2013 11:35 am

Post by vincent_angbt » Tue Jun 21, 2016 5:06 pm

Hi,

I notice if the image with the space in the image files name, it will cause the og error.

How can I do in order the image manager will auto remove all the space in the image files name ?

New member

Posts

Joined
Tue Dec 17, 2013 11:35 am

Post by i2Paq » Tue Jun 21, 2016 5:19 pm

I have merged you 2 topics as they are about the same issue.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by Burt65 » Tue Jun 21, 2016 5:21 pm

vincent_angbt wrote:Hi,

I notice if the image with the space in the image files name, it will cause the og error.

How can I do in order the image manager will auto remove all the space in the image files name ?
Hi Vincent

You are correct server don't like filename with spaces. You can use an extension that will also automatically replace empty spaces with an underscore so to eliminate this problem...

This is one for example:

http://www.opencart.com/index.php?route ... n_id=19083

Over 95% of all computer problems can be traced back to the interface between the keyboard and the chair...


User avatar
Active Member

Posts

Joined
Mon Nov 18, 2013 3:23 pm
Location - Oz

Post by ojars26 » Tue Jun 21, 2016 9:13 pm

Hi!
I updated the filemanager ocmod. now it will also add underscore when you upload image.

example:
upload = "image name u nderscore.jpg"
result = "image_name_____u_nderscore.jpg"

Attachments


User avatar
Newbie

Posts

Joined
Wed May 25, 2016 5:04 am

Post by straightlight » Tue Jun 21, 2016 9:23 pm

ojars26 wrote:Hi!
I updated the filemanager ocmod. now it will also add underscore when you upload image.

example:
upload = "image name u nderscore.jpg"
result = "image_name_____u_nderscore.jpg"
The mount of underscore should be filtered so to output a unique underscore when tracking filenames in case multiple instances of underscore would be used to the same location on a filename.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ojars26 » Tue Jun 21, 2016 9:39 pm

It is correctly filtered.

Code: Select all

upload =  "image name     u nderscore.jpg" 
result =  "image_name_____u_nderscore.jpg"

User avatar
Newbie

Posts

Joined
Wed May 25, 2016 5:04 am

Post by straightlight » Tue Jun 21, 2016 10:03 pm

result = "image_name_____u_nderscore.jpg"
No, it's not. The mount of space shouldn't follow with the same mount of underscores. It should rather be filtered with a unique underscore on filenames.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ojars26 » Wed Jun 22, 2016 6:41 am

straightlight wrote:
result = "image_name_____u_nderscore.jpg"
No, it's not. The mount of space shouldn't follow with the same mount of underscores. It should rather be filtered with a unique underscore on filenames.
like this?

Code: Select all

upload =  "image name     u nderscore.jpg" 
result =  "image_name_u_nderscore.jpg"

User avatar
Newbie

Posts

Joined
Wed May 25, 2016 5:04 am

Post by straightlight » Wed Jun 22, 2016 7:57 am

ojars26 wrote:
straightlight wrote:
result = "image_name_____u_nderscore.jpg"
No, it's not. The mount of space shouldn't follow with the same mount of underscores. It should rather be filtered with a unique underscore on filenames.
like this?

Code: Select all

upload =  "image name     u nderscore.jpg" 
result =  "image_name_u_nderscore.jpg"
Yes, that would be the right file structure. Although, I would also limit the string size in case it gets too long - ending with a random number as an ending length in case it would exceed the length of characters on the filename.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by vincent_angbt » Wed Jun 22, 2016 1:04 pm

ojars26 wrote:Hi!
I updated the filemanager ocmod. now it will also add underscore when you upload image.

example:
upload = "image name u nderscore.jpg"
result = "image_name_____u_nderscore.jpg"
Hi,
i am using default themes, will this override any files ?
and, i am using v2.1.0.2, this will work right, according to the http://www.opencart.com/index.php?route ... n_id=19083 it's compatible.

what's the different of:
PowerImageManager.MijoShop.ocmod.zip & PowerImageManager.3.1.4.ocmod.zip ???

New member

Posts

Joined
Tue Dec 17, 2013 11:35 am

Post by straightlight » Wed Jun 22, 2016 11:46 pm

Since you're using a contributed file manager, you'd need to contact the developer of that extension to get more information regarding your last enquiry.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by vincent_angbt » Thu Jun 23, 2016 1:28 am

straightlight wrote:Since you're using a contributed file manager, you'd need to contact the developer of that extension to get more information regarding your last enquiry.
if there any code we can change in order to achieve this ???

New member

Posts

Joined
Tue Dec 17, 2013 11:35 am

Post by straightlight » Thu Jun 23, 2016 1:37 am

what's the different of:
PowerImageManager.MijoShop.ocmod.zip & PowerImageManager.3.1.4.ocmod.zip
For those inquiries, you need to contact the developer of those contributions.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ojars26 » Thu Jun 23, 2016 4:18 am

this is my final change - made for my self. :)

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<modification>
  <name>Opencart 2.x-2.2 filemanager upload_add_underscore and view-fix</name>
  <code>8859B85845BE3476E907250B88</code>
  <version>1.0.2</version>
  <author>ojars26</author>
  <file path="admin/controller/common/filemanager.php">
	<operation>
      <search>
        <![CDATA['name'  => implode(' ', $name),]]>
      </search>
      <add position="replace">
        <![CDATA['name'  => basename($image), //without added spaces, longnames fixed with in filemanager.tpl adding style="word-wrap: break-word;"]]>
      </add>
    </operation>
	<operation>
      <search>
        <![CDATA[$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));]]>
      </search>
      <add position="after">
        <![CDATA[$filename = str_replace(' ', '_', preg_replace('/\s+/', ' ', $filename)); //Remove extra spaces & replace spaces with underscore]]>
      </add>
    </operation>
  </file>
  <file path="admin/view/template/common/filemanager.tpl">
	<operation>
      <search>
        <![CDATA[<div class="col-sm-3 text-center">]]>
      </search>
      <add position="replace">
        <![CDATA[<div class="col-sm-3 text-center" style="word-wrap: break-word;">]]>
      </add>
    </operation>
  </file>
</modification>

Attachments


User avatar
Newbie

Posts

Joined
Wed May 25, 2016 5:04 am

Post by straightlight » Thu Jun 23, 2016 5:02 am

Thanks. So far, it would make sense to add this as a core fix in future releases. This is especially useful for POSIX-compliant file systems .

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 74 guests