Page 2 of 4
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 12:00 am
by R_D
straightlight wrote:Do you see any error messages on the top of your screen when trying to upload png files?
If not, in your admin - > systems - > tools - > error log page, do you see any latest event regarding the filemanager.php file?
Nope, no errors in the error.log
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 12:04 am
by straightlight
Go to your admin - > systems - > settings - > edit store - > server tab - > Error Handling. Are the first and second option enable on that section? If not, enable them.
Then, save the changes. Retry the file manager with PNG, notice if there are any errors on top of the screen and in the error log. When viewing the error log, ensure to see the latest date and time on the left-end side.
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 12:09 am
by R_D
straightlight wrote:Go to your admin - > systems - > settings - > edit store - > server tab - > Error Handling. Are the first and second option enable on that section? If not, enable them.
Then, save the changes. Retry the file manager with PNG, notice if there are any errors on top of the screen and in the error log. When viewing the error log, ensure to see the latest date and time on the left-end side.
They are on, but no errors in the log file....
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 12:15 am
by IP_CAM
SORRY! Unfortunately, this is the case, and, in my case, regardless of trying with xxx.JPG or xxx.PNG !
No error, nothing !
Ernie
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 12:24 am
by straightlight
While one may be able to upload, since each server configurations may differ, screenshots would be inaccurate in this case since there are developed and engineered functions that are able to troubleshoot uploaded files on a web server as the reported issue only requires troubleshooting.
In admin/controller/common/filemanager.php file,
find:
Code: Select all
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
replace with:
Code: Select all
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name']) && is_uploaded_file($this->request->files['file']['tmp_name'])) {
Then, try the action again. With this replacement, it not only verifies the source file but also valdates if the file has been successfully uploaded to the server.
As for this line:
Code: Select all
$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
There are three files in OC v2.2.0.0 that shows as such and I don't entirely agree with this. That being said, each should be replaced with:
Code: Select all
$filename = html_entity_decode(basename($this->request->files['file']['name']), ENT_QUOTES, 'UTF-8');
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 12:38 am
by R_D
straightlight wrote:While one may be able to upload, since each server configurations may differ, screenshots would be inaccurate in this case since there are developed and engineered functions that are able to troubleshoot uploaded files on a web server as the reported issue only requires troubleshooting.
In admin/controller/common/filemanager.php file,
find:
Code: Select all
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
replace with:
Code: Select all
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name']) && is_uploaded_file($this->request->files['file']['tmp_name'])) {
Then, try the action again. With this replacement, it not only verifies the source file but also valdates if the file has been successfully uploaded to the server.
As for this line:
Code: Select all
$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
There are three files in OC v2.2.0.0 that shows as such and I don't entirely agree with this. That being said, each should be replaced with:
Code: Select all
$filename = html_entity_decode(basename($this->request->files['file']['name']), ENT_QUOTES, 'UTF-8');
It works! I've done all from the above and changed it in the admin/controller/common/filemanager.php file and now it is inserted into the description! Thanks!!!
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 12:48 am
by straightlight
Excellent. This issue was definitely a bug.
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 12:59 am
by R_D
straightlight wrote:Excellent. This issue was definitely a bug.
Any chance you can help me with a missing base url for images?

Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 1:02 am
by straightlight
Now that we know the above was a bug, I would suggest to apply the same fixes to the following files for OC v2.2.0.0 release:
- admin/controller/catalog/download.php file
- admin/controller/feed/google_base.php file
This should definitely rectify the issue.
As for the rest of the upload files that wasn't covered in the topic, here are the following fixes as well.
In admin/controller/extension/installer.php file,
find:
Code: Select all
if (strrchr($this->request->files['file']['name'], '.') == '.xml') {
replace with:
Code: Select all
if (is_uploaded_file($this->request->files['file']['name']) && strrchr($this->request->files['file']['name'], '.') == '.xml') {
In admin/controller/tool/upload.php file,
find:
Code: Select all
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
replace with:
Code: Select all
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name']) && is_uploaded_file($this->request->files['file']['tmp_name'])) {
In your catalog/controller/tool/upload.php file,
find:
Code: Select all
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
replace with:
Code: Select all
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name']) && is_uploaded_file($this->request->files['file']['tmp_name'])) {
Then, find:
Code: Select all
$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
replace with:
Code: Select all
$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
As for this line, I have no idea why it would be the
only line matching for REGEXP compared to the rest of the other uploads in the platform:
Code: Select all
$filename = basename(preg_replace('/[^a-zA-Z0-9\.\-\s+]/', '', html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8')));
replace with:
Code: Select all
$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
If there is really something special about that line and should be the only line to where special chars should be considered throughout the rest of the
same process of Opencart, at least - if there's one thing useful about GitHub would be to document the difference on that upload !
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 1:02 am
by straightlight
R_D wrote:straightlight wrote:Excellent. This issue was definitely a bug.
Any chance you can help me with a missing base url for images?

Could you elaborate that a little?
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 1:06 am
by R_D
straightlight wrote:R_D wrote:straightlight wrote:Excellent. This issue was definitely a bug.
Any chance you can help me with a missing base url for images?

Could you elaborate that a little?
I've already had a post about it:
http://forum.opencart.com/viewtopic.php?f=188&t=163914
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 1:08 am
by straightlight
I have modified my steps above. It seem that even the basename doesn't fit on either cases. Tested with full base URL; now working.
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 1:15 am
by IP_CAM
I can just repeat it again !
Ernie
PS: works only for sure after a full clear out of
/system/storage/cache/... Sub Content, the both
/vqmod/xxx.cache files and the
/vqmod/vqcache/... Sub Content! If someone uses
OcMod-Extensions, also RESET all this as well!
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 1:46 am
by straightlight
It indicates in your last response that you would try it but no results were posted afterwards. Would it be possible to post more details about this?
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 2:05 am
by IP_CAM
This is my LATEST tested VqMod Version on my OC v.2.2.0.0, after putting the formerly
modified files back to default OC Mode. The Results, produced by the VqMod, can be seen here:
http://www.bigmax.ch/oc22/index.php?rou ... duct_id=42
---
IMPORTANT, regarding Images acting responsive, read this Post as well:
http://forum.opencart.com/viewtopic.php ... 40#p626266
---
image_bug_quick_fix_oc_22.xml
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id><![CDATA[Image Directory Bug Fix OC v.2.2.x]]></id>
<version><![CDATA[OC v.2.2.x]]></version>
<vqmver><![CDATA[2.6.1]]></vqmver>
<author><![CDATA[straightlight - VqModded by IP_CAM]]></author>
<file name="admin/controller/common/filemanager.php">
<operation error="log">
<search position="replace"><![CDATA[
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
]]></search>
<add><![CDATA[
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name']) && is_uploaded_file($this->request->files['file']['tmp_name'])) {
]]></add>
</operation>
<operation error="log">
<search position="replace"><![CDATA[
$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
]]></search>
<add><![CDATA[
$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
]]></add>
</operation>
</file>
<file name="admin/controller/catalog/download.php">
<operation error="log">
<search position="replace"><![CDATA[
$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
]]></search>
<add><![CDATA[
$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
]]></add>
</operation>
</file>
<file name="admin/controller/feed/google_base.php">
<operation error="log">
<search position="replace"><![CDATA[
$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
]]></search>
<add><![CDATA[
$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
]]></add>
</operation>
</file>
<file name="admin/controller/extension/installer.php">
<operation error="log">
<search position="replace"><![CDATA[
if (strrchr($this->request->files['file']['name'], '.') == '.xml') {
]]></search>
<add><![CDATA[
if (is_uploaded_file($this->request->files['file']['name']) && strrchr($this->request->files['file']['name'], '.') == '.xml') {
]]></add>
</operation>
</file>
<file name="admin/controller/tool/upload.php">
<operation error="log">
<search position="replace"><![CDATA[
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
]]></search>
<add><![CDATA[
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name']) && is_uploaded_file($this->request->files['file']['tmp_name'])) {
]]></add>
</operation>
</file>
<file name="catalog/controller/tool/upload.php">
<operation error="log">
<search position="replace"><![CDATA[
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
]]></search>
<add><![CDATA[
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name']) && is_uploaded_file($this->request->files['file']['tmp_name'])) {
]]></add>
</operation>
<operation error="skip">
<search position="replace"><![CDATA[
$filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
]]></search>
<add><![CDATA[
$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
]]></add>
</operation>
<operation error="log">
<search position="replace"><![CDATA[
$filename = basename(preg_replace('/[^a-zA-Z0-9\.\-\s+]/', '', html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8')));
]]></search>
<add><![CDATA[
$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
]]></add>
</operation>
</file>
</modification>
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 2:20 am
by straightlight
The basename was removed and mentioned on my previous post. Your XML file will cause the relative path to be removed. You'll need to re-compare your XML with my fix.
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 2:24 am
by IP_CAM
I made it, to implement all of your Changes, as mentioned to this!
Shall I change anything? It's planned to do it all at once, for those, using 'virgin' Source!?
Ernie
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 2:46 am
by straightlight
IP_CAM wrote:I made it, to implement all of your Changes, as mentioned to this!
Shall I change anything? It's planned to do it all at once, for those, using 'virgin' Source!?
Ernie
As you can see from my modifications, the basename function has been removed after I edited it and announced. You'd need to re-modify the XML file. Otherwise, it will lead people not being able to upload to their relative path.
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 3:51 am
by IP_CAM
So, I removed all basename-related sections.
untested, but it won't do any harm, I guess !
Ernie
Re: Problem with Image Manager
Posted: Wed Jun 29, 2016 3:57 am
by straightlight
IP_CAM wrote:So, I removed all basename-related sections.
untested, but it won't do any harm, I guess !
Ernie
You removed the entire XML blocks to where the basename originates ... while this portion of code is what needs to be replaced into:
Code: Select all
$filename = html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8');
as per my instructions indicates. As for the rest of the replacements, it should be fine.