system auto add space in image name
Posted: Sun Jun 19, 2016 10:55 pm
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.
OpenCart Community Forum - Discuss shopping cart and e-commerce solutions.
https://forum.opencart.com/
Hi, can give the link as my version is 2.0.1.2.ojars26 wrote:I use this and it works for me! No-spaces in filename or directory
Hi Vincentvincent_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 ?
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.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"
Code: Select all
upload = "image name u nderscore.jpg"
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.result = "image_name_____u_nderscore.jpg"
like this?straightlight wrote: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.result = "image_name_____u_nderscore.jpg"
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.ojars26 wrote:like this?straightlight wrote: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.result = "image_name_____u_nderscore.jpg"
Code: Select all
upload = "image name u nderscore.jpg" result = "image_name_u_nderscore.jpg"
Hi,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"
if there any code we can change in order to achieve thisstraightlight 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.
For those inquiries, you need to contact the developer of those contributions.what's the different of:
PowerImageManager.MijoShop.ocmod.zip & PowerImageManager.3.1.4.ocmod.zip
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>