Warning: getimagesize(/home/sbmkskfv/public_html/image/catalog/danese/thum/Itka-table-lamp.jpg): failed to open stream: No such file or directory in /home/sbmkskfv/public_html/catalog/model/tool/image.php
I understand why the error is coming because the image/path is not matching to be case sensitive, I can't rename all the images because there are so many images in the image folder.
Image Path/Name is same but image name 'Itka-table-lamp.jpg' *I* capital letter in the database and *i* small letter in folder
Please help me to solve this issue.
Thank you.
Attachments
screenshot - image folder.PNG (5.84 KiB) Viewed 1719 times
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
Doesn't seem like a good solution to me tbh.
I think the best solution would be to rename he images with a script.
Get in touch if you want to pay us to do it, it would be something like this:
Code: Select all
find my_root_dir -depth -exec rename 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \;
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Why not? This way you won't have to update image files and a single additional function won't hurt.
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
Replace
Code: Select all
public function resize($filename, $width, $height) {
.....
}
With
Code: Select all
public function resize($filename, $width, $height) {
$filename = mb_strtolower($filename);
....
}
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Simply adding mb_strtolower on the retrieved filename from the database would only work if all filenames in the filesystem are lowercase.
It may solve this case for itka-table-lamp.jpg but it would break the case for Itka_pendant_lamp.jpg
So you would also have to make all your image filesystem lowercase for this to work or if it is incidental, manually adjust one or the other.
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Thanks @straightlight, it's very obvious that modifying the site code just because your files are named differently to your database is nasty and hacky and I can't believe the devs above have suggested it tbh. Poor advice guys.straightlight wrote: ↑Fri May 14, 2021 10:48 pmRenaming the files from console would be the right path
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
What I'm interested to know is... what were you using to upload the files that's converting all the filenames to lowercase? Pretty serious bug for any file uploader to be automatically mangling filenames like that.santanu2019 wrote: ↑Fri May 14, 2021 2:21 pmAfter uploading the image folder to the server ...
... Image Path/Name is same but image name 'Itka-table-lamp.jpg' *I* capital letter in the database and *i* small letter in folder
It's not a bug, it's server-wise based on its OS distribution.joeantropy wrote: ↑Mon May 17, 2021 6:58 pmWhat I'm interested to know is... what were you using to upload the files that's converting all the filenames to lowercase? Pretty serious bug for any file uploader to be automatically mangling filenames like that.santanu2019 wrote: ↑Fri May 14, 2021 2:21 pmAfter uploading the image folder to the server ...
... Image Path/Name is same but image name 'Itka-table-lamp.jpg' *I* capital letter in the database and *i* small letter in folder
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I'd suggest that even on Windows it would be better to keep filenames and db entries with matching case.straightlight wrote: ↑Mon May 17, 2021 7:04 pmIt's not a bug, it's server-wise based on its OS distribution.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Windows server is not under client-servers' controls to manage these types of settings with IIS. Even though similarities of .htaccess could be used, these configurations are still in the hands of IT administrators as opposed to other OSes.paulfeakins wrote: ↑Mon May 17, 2021 7:12 pmI'd suggest that even on Windows it would be better to keep filenames and db entries with matching case.straightlight wrote: ↑Mon May 17, 2021 7:04 pmIt's not a bug, it's server-wise based on its OS distribution.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I'm sure it's possible even on Windows to get the uploaded filename in the correct case?straightlight wrote: ↑Mon May 17, 2021 7:20 pmWindows server is not under client-servers' controls to manage these types of settings with IIS. Even though similarities of .htaccess could be used, these configurations are still in the hands of IT administrators as opposed to other OSes.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Depending on the disk partitions being used on the server. Web users have no controls based on those configurations.paulfeakins wrote: ↑Mon May 17, 2021 7:25 pmI'm sure it's possible even on Windows to get the uploaded filename in the correct case?straightlight wrote: ↑Mon May 17, 2021 7:20 pmWindows server is not under client-servers' controls to manage these types of settings with IIS. Even though similarities of .htaccess could be used, these configurations are still in the hands of IT administrators as opposed to other OSes.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
However, by default, Windows processes treat the file system as case insensitive. They do not differentiate between files or folders based on case.
But Windows 10 now offers an optional case-sensitive file system, just like Linux and other UNIX-like operating systems. All Windows processes will handle case-sensitive files and folders properly if you enable this feature. In other words, they'll see “file” and “File” as two separate files.
See https://www.windowscentral.com/how-enab ... windows-10
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Code: Select all
$path = substr($temp_image_path, strrpos($temp_image_path, '/') + 1);
$dir = dirname($temp_image_path);
if ($handle = opendir($dir)) {
while (false !== ($entry = readdir($handle))) {
if (strtolower($path) == strtolower($entry)){
$temp_image_path = $dir . '/' . $entry ;
}
}
closedir($handle);
}
What was the solution?
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I have edited my last comment with a solution
So, now I have to get a couple of scripts working - once to rename all the files and directories on my server to lower case, the other to fix the database listings...as I said. Gah!
Any particular reason why OC (3.0.3.6 in my case) actually cares about case in file names and directories, or is that simply good programming practice? I missed that lesson...
Users browsing this forum: labeshops and 18 guests