Page 1 of 1

White Space showing in image name

Posted: Sat Jun 16, 2018 10:27 pm
by frankpmjr
Hello,
I am migrating an OC site from one host to the next and upgrading to 3.0 at the same time. All is going well but I FTPed all my images from old host to new host and when I uploaded my products a bunch of the pics came up blank. After a little poking around I found that a lot (more than half) of the pics have white spaces injected into them but only in the admin (if I add a picture to a product manually I see the whitespace) but if I look in the actual picture folder (using FTP or Cpanel) the name is fine. So I can't fix it reuploading or renaming the file in the Cpanel or via FTP. How do I get around this other than manually inserting every picture (about 1000 that didn't link when I did the uploads)? Thanks

Re: White Space showing in image name

Posted: Sun Jun 17, 2018 1:54 am
by sw!tch
Only thing I can think is your encoding is different between hosts and handling character set differently, either mySQL or when you uploaded them via FTP. You can try using gzip to pack all the images from your old host and then unzip them on the new host. Or when you did your database import the encoding is different.

Too little information you provided to be any help.

Re: White Space showing in image name

Posted: Sun Jun 17, 2018 2:10 am
by IP_CAM
Well, you could download your images by FTP, to get 'em all, and then,
use a File Manager, or later an SEO Tool, to have 'em renamed. But be
aware, that every single image needs to be re-linked to the product again.
You should have been doing this before, it would have saved some time,
to do such according http-standards, valid, since the internet started to exist. :-\
Good Luck
Ernie
---
Mass Image Rename
https://www.opencart.com/index.php?rout ... n_id=14343
---
Product Image Bulk Rename - SEO Image Name Manager
https://www.opencart.com/index.php?rout ... n_id=19737
---
File Manager
Normalizer : UTF-8 Normalizer of file-name and file-path etc.
Sanitizer : Sanitizer of file-name and file-path etc.
https://www.opencart.com/index.php?rout ... n_id=32460
---

Re: White Space showing in image name

Posted: Mon Mar 25, 2019 6:48 am
by ArtGallery
I am experiencing the same issue. Images uploaded through the Admin for an individual product will sometimes display blank spaces between some characters in the file name. This doesn't happen every time, but once it occurs, it stays that way permanently.
Example:
Original File Name product-name-2x55.jpg is showing as product-name-2x5 5.jpg -- Note the blank space between the fives. This is only how it is shown in the Image Manager. The actual file names are not changed in the images folder. When I first noticed it I thought I had made an error in naming the original file, which was not the case. Everything seems to be displaying fine on the front end.

Re: White Space showing in image name

Posted: Mon May 13, 2019 10:56 pm
by henfeb
I am facing the same from of my filenames in opencart image viewer showing blank spaces. e.g hello.jpg becomes hello.jp g
I tried to delete everything and reupload the images. But somehow the filenames just randomly have spaces. The Catalog/images filenames are normal with no spaces. My website is not showing the images with the problem. I hope someone can help me with this problem. Thank you

Re: White Space showing in image name

Posted: Thu May 16, 2019 10:53 am
by henfeb
Image

I hope somebody can help me.
Why there are random spaces for the filenames when in Opencart?
But when I look at the root directory of server"images>catalog" folder the file names doesn't have those spaces?

Re: White Space showing in image name

Posted: Sat May 18, 2019 3:36 pm
by letxobnav
probably to do with artificial wrapping of file/directory names to make the file-manager grid look nice with long file/directory names.

it first splits the names at 14 characters:

Code: Select all

$name = str_split(basename($image), 14);
and then glues them back again with a space added.

Code: Select all

'name'  => implode(' ', $name),

Re: White Space showing in image name

Posted: Thu Feb 20, 2020 6:19 am
by Jaesin
Wow... the search actually worked and I found this thread..
Thanks for the answer, kind of silly thing to do really.

Re: White Space showing in image name

Posted: Sat Sep 12, 2020 6:21 am
by info@wescomedia.com
letxobnav wrote:
Sat May 18, 2019 3:36 pm
probably to do with artificial wrapping of file/directory names to make the file-manager grid look nice with long file/directory names.

it first splits the names at 14 characters:

Code: Select all

$name = str_split(basename($image), 14);
and then glues them back again with a space added.

Code: Select all

'name'  => implode(' ', $name),

That was a nice catch to fix the Image Manager "white space" issue.
store/controller/common/filemanger.php

Code: Select all

'name'  => implode(' ', $name),
change to

Code: Select all

'name'  => implode('', $name),
My images still won't show up in admin or customer side.

Re: White Space showing in image name

Posted: Sat Sep 12, 2020 6:58 am
by letxobnav
that code is for how the name is displayed, not for how your images are found or not.

Re: White Space showing in image name

Posted: Sat Sep 12, 2020 9:43 pm
by straightlight
Already fixed on the master branch.

Re: White Space showing in image name

Posted: Sun Sep 13, 2020 1:21 am
by info@wescomedia.com
yep... it fixed the white space issue.
Still looking for a reason the images won't show up in Image Manager or browser.
The store logo shows up but not product images.

Code: Select all

define('DIR_IMAGE', '/home/mysite/public_html/store/image/');
I've tried to change it as a test, but the store logo won't show. So I feel that this is the correct path.
Wondering if it's a PHP version issue. I'm on PHP 5.4.45

Re: White Space showing in image name

Posted: Sun Sep 13, 2020 2:52 am
by IP_CAM
??? PHP 5.4.45
You should move up fast, that time is really over ...

Re: White Space showing in image name

Posted: Sun Sep 13, 2020 12:02 pm
by info@wescomedia.com
IP_CAM wrote:
Sun Sep 13, 2020 2:52 am
??? PHP 5.4.45
You should move up fast, that time is really over ...
I know. It's a leased/shared server. They offer to upgrade but I'm worried sites will have issues. I host dozens, so It's scary.

Re: White Space showing in image name

Posted: Sun Sep 13, 2020 6:01 pm
by sw!tch
info@wescomedia.com wrote:
Sun Sep 13, 2020 12:02 pm
I know. It's a leased/shared server. They offer to upgrade but I'm worried sites will have issues. I host dozens, so It's scary.
Scary is running a 5 year old EOL PHP version. You should ask your host if they have multi-php support, you could then slowly migrate your sites to newer PHP versions instead of an all at once upgrade.

Surprised hosts still even offer 5.4 as an option. In any case, should really get that updated or hire a developer to work with you, PHP 7 brought a lot of speed enhancements to PHP.

Re: White Space showing in image name

Posted: Sun Sep 13, 2020 9:26 pm
by IP_CAM
My Hoster offers a function, to be placed in line 1 of the
(ROOT+) SHOP .htaccess file of each OC Site I have, to
individually select the PHP Version used. It looks like this:

Code: Select all

AddHandler application/x-httpd-php72 .php
#@__HCP_END__@# 

Code: Select all

AddHandler application/x-httpd-php73 .php
#@__HCP_END__@# 

Code: Select all

AddHandler application/x-httpd-php74 .php
#@__HCP_END__@# 
And if you have some older OC Versions on your Site, they usually only require
another system/library/encryption.php File, to work flawless with PHP v.7.4.9
so far, depending on, what's available on PHP Versions from the Hoster.
At least, if used with default-theme-like installs, but I don't know about JOURNAL ... ::)
That's the one I use for my v.1.5.6.5_rc Versions:

Code: Select all

<?php
final class Encryption {
	private $key;
	private $iv;
	
	public function __construct($key) {
		$this->key = $key;
	}
	
	public function encrypt($value) {
		return strtr(base64_encode(openssl_encrypt($value, 'aes-128-cbc', hash('sha256', $this->key, true))), '+/=', '-_,');
	}
	
	public function decrypt($value) {
		return trim(openssl_decrypt(base64_decode(strtr($value, '-_,', '+/=')), 'aes-128-cbc', hash('sha256', $this->key, true)));
	}
}
?>
So, better ask your Hoster, if something similar exists, to individually adjust your Sites.
Ernie

Some (OC v.1.5.6.x / 2.x) encryption.php files can be found here, it's the same for those Versions:
https://www.opencart.com/index.php?rout ... earch=php7

Re: White Space showing in image name

Posted: Mon Sep 14, 2020 12:09 am
by letxobnav
so we go from image name white space to not finding images to php versions to encryption back to php version switching, what could be next?

Re: White Space showing in image name

Posted: Mon Sep 14, 2020 12:55 am
by by mona
Christmas !


I believe this second issue is SOLVED in a new thread
viewtopic.php?f=170&t=219957

Re: White Space showing in image name

Posted: Mon Sep 14, 2020 3:39 am
by IP_CAM
so we go from image name white space to not finding images to php versions to encryption back to php version switching, what could be next?
Well, it's called 'combining knowledge', a Topic, where one can also find other Wisdom and
Download Links, to find solutions, or possibly solve problems, before they even exist.... ;) :D
This Place her is not so transparent, and what's not linked in 'main' Sections, is quite
hardly to be found, especially for Newbies, partly not even aware of what they use ...
In addition the the known fact, that the Forum Search Engine is just a piece of crab ... :-\
But most important is, to have it 'googled', it saves a lot of bread, to still stay atop ... :laugh:
And that's possible, if one takes care, to 'please' those fellows too, with, what they're looking for.
It's called 'CONTENT'
Ernie ;)