Post by Dr.F@ust » Wed Aug 11, 2010 5:52 pm

web2works wrote:Right if you make the changes below you should get the image browse button back. I normally dont like to make changes to the functionality of opencart to allow for easy of upgrade further down the line. Here I have added the original browse button to the image (Data Tab). Reason for this is that on the Data tab you only want to upload one image so what is the point in browsing through 1000s of images and waiting for them all to load. Although I have left the Image File Manage in the Image tab to allow for multiple images to be selected/uploaded.

The new image manager is all done through AJAX so there is I am not going to remove any code just simple add the original code.

STEP1 get the physical button back
In - /admin/view/template/catalog/product_form.tpl
If you replace:

Code: Select all

 
<tr>
     <td><?php echo $entry_image; ?></td>
     <td><input type="hidden" name="image" value="<?php echo $image; ?>" id="image" />
     <img src="<?php echo $preview; ?>" alt="" id="preview" style="border: 1px solid #EEEEEE;"/> 
      &nbsp;<img src="view/image/image.png" alt="" style="cursor: pointer;" align="top" onclick="image_upload('image', 'preview');" />
     </td>
</tr>
With:

Code: Select all

 
<tr>
      <td><?php echo $entry_image; ?></td>
      <td><input type="file" name="image" /></td>
</tr>
<tr>
     <td></td>
     <td><img src="<?php echo $preview; ?>" alt="" style="margin: 4px 0px; border: 1px solid #EEEEEE;" /></td>
</tr>
Now open: /admin/controller/catalog/product.php

STEP2
Inside public function insert() around line 24.
Find: if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
Add below:

Code: Select all

if (is_uploaded_file($this->request->files['image']['tmp_name']) && is_writable(DIR_IMAGE) && is_writable(DIR_IMAGE . 'cache/')) {
				move_uploaded_file($this->request->files['image']['tmp_name'], DIR_IMAGE . $this->request->files['image']['name']);
				
				if (file_exists(DIR_IMAGE . $this->request->files['image']['name'])) {
					$data['image'] = $this->request->files['image']['name'];
				}			
			}
			
			if (isset($this->request->files['product_image'])) {
				foreach (array_keys($this->request->files['product_image']['name']) as $key) {
					if (is_uploaded_file($this->request->files['product_image']['tmp_name'][$key]) && is_writable(DIR_IMAGE) && is_writable(DIR_IMAGE . 'cache/')) {
						move_uploaded_file($this->request->files['product_image']['tmp_name'][$key], DIR_IMAGE . $this->request->files['product_image']['name'][$key]);
						
						if (file_exists(DIR_IMAGE . $this->request->files['product_image']['name'][$key])) {
							$data['product_image'][] = $this->request->files['product_image']['name'][$key];
						}
					}
				}
			}
STEP3
Inside public function update() around line 85.
Find: if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
$data = array();
Add below:

Code: Select all

if (is_uploaded_file($this->request->files['image']['tmp_name']) && is_writable(DIR_IMAGE) && is_writable(DIR_IMAGE . 'cache/')) {
				move_uploaded_file($this->request->files['image']['tmp_name'], DIR_IMAGE . $this->request->files['image']['name']);
				
				if (file_exists(DIR_IMAGE . $this->request->files['image']['name'])) {
					$data['image'] = $this->request->files['image']['name'];
				}			
			} 
	
			if (isset($this->request->files['product_image'])) {
				foreach (array_keys($this->request->files['product_image']['name']) as $key) {
					if (is_uploaded_file($this->request->files['product_image']['tmp_name'][$key]) && is_writable(DIR_IMAGE) && is_writable(DIR_IMAGE . 'cache/')) {
						move_uploaded_file($this->request->files['product_image']['tmp_name'][$key], DIR_IMAGE . $this->request->files['product_image']['name'][$key]);
						
						if (file_exists(DIR_IMAGE . $this->request->files['product_image']['name'][$key])) {
							$data['product_image'][] = $this->request->files['product_image']['name'][$key];
						}
						
						unset($this->request->post['product_image'][$key]);
					}
				}
			}
			
			if (isset($this->request->post['product_image'])) {
				foreach (array_keys($this->request->post['product_image']) as $key) {
					$data['product_image'][] = $this->request->post['product_image'][$key];
					
					unset($this->request->post['product_image'][$key]);
				}
			}

It is don't work. :(

Maybe someone knows how to fix?

Newbie

Posts

Joined
Wed Aug 11, 2010 5:39 pm

Post by rofilu » Wed Aug 18, 2010 2:49 am

Solved for me

/image/cache/data and
/image/data

must have same folders with permission 777

for me is ok

work now

Newbie

Posts

Joined
Mon Aug 16, 2010 6:01 pm

Post by Dr.F@ust » Thu Aug 19, 2010 7:23 pm

all permissions set 777.

but the file does not load.

maybe it works on older versions.

Newbie

Posts

Joined
Wed Aug 11, 2010 5:39 pm

Post by rupertrutland » Sat May 07, 2011 9:48 pm

Hi,

I have exactly the same issue.

I have a local version which works fine and then I have a test version on a linode server and I can't see/upload/delete etc... the images even though I think I have set the right permissions on the files/dirs suggested in the install.txt.

Bit of a pain....

Newbie

Posts

Joined
Sun May 01, 2011 8:47 pm

Post by rupertrutland » Sat May 07, 2011 10:08 pm

Ok,

Just fixed my problem

I think I had the wrong permissions on the download directory so i did:

chmod -R 0777 download/

Only just starting with some sys admin stuff and I know this is bad but it's just a test site so i dont care. Will refine the security to rw without executable.

I think the -R was important in fixing it as I don't think I had done that before.

Newbie

Posts

Joined
Sun May 01, 2011 8:47 pm

Post by garyjob » Mon Jul 25, 2011 10:57 am

Hi, to know what exact error is being thrown up by the Ajax call made by the Image Manager, you might want to install firebug on firefox. I met the same error just this morning and was rather puzzled, since I did see all my images at this location /public_html/image/data via ftp.

Hence I ran a test using firebug on firefox. I managed to see the Ajax error message response thrown up by the server in my firebug. It is indeed a file permission error. However this file permission error happened at a different location. The location is here instead
/public_html/image/cache

Apparently, the system attempts to create a minature replica of your actual image and load that miniature replica in the location /public_html/image/cache for your viewing. So if the system is not able to do so, it throws a file permission error. Since the ajax client is only programmed to understand JSON messages. Such a strange ill formatted response by the server will cause a Javascript error in the front end. Also since there is not exception handler built in to the front end javascript, the user is not notified that he really needs to go sort out the file permission error in the backend. He is thus left with an empty image.

Hope this helps.

Cheers
Gary
Singapore Shopping Cart Designer

Newbie

Posts

Joined
Mon Jul 25, 2011 10:44 am

Post by pradeepn » Wed Aug 10, 2011 12:49 pm

The image file manager was working, but it then stopped. Not sure if any of the configuration in apache, .htaccess or something broke it. Now I don't see any images displayed nor I could upload any image.

Since then I tried all versions 1.4.9, 1.5, 1.5.0.5, 1.5.1, 1.5.1.1 installing from scratch again, but it never worked.
It leads me to think it is something in my configuration outside the opencart installation.

I also see the drop down list for Region / State in the System -> Setting-> Edit Store -> Local panel is also blank.


Anyone has any ideas how to resolve this ?

Thanks in advance.

Newbie

Posts

Joined
Fri Jul 08, 2011 9:12 am

Post by pradeepn » Thu Aug 11, 2011 1:29 am

I was able to solve this problem by ensuring the all admin requests were set to https in the admin/config.php
I had enabled HTTPS and was forcing all URI's with /admin to be HTTPS. It seems there were some redirects happening (302 Not Found) which seems to be causing the problem. I also see the State/Region drop down work ok now.

// HTTP
define('HTTP_SERVER', 'https://XXX/admin');
define('HTTP_CATALOG', 'https:/XXX/');
define('HTTP_IMAGE', 'https://XXX/image');

// HTTPS
define('HTTPS_SERVER', 'https://XXX/admin/');
define('HTTPS_IMAGE', 'https://XXX/image/');

Newbie

Posts

Joined
Fri Jul 08, 2011 9:12 am

Post by sdstore » Sat Jan 21, 2012 6:04 am

SOLVED for me.

I removed all whitespaces from the end of "admin/index.php" file. File should strictly ends with "?>".

Newbie

Posts

Joined
Wed Jun 29, 2011 8:38 am

Post by lpalagashvili » Sat Jan 21, 2012 7:17 am

Hi All,
On my Admin-Product-Data tab, my image uploader is not appearing at all. I am attaching the print screen of the issue.
Any suggestions would be appreciated.
Thanks!

Attachments

Product Image Issue.jpg

Product Image Issue.jpg (3.37 KiB) Viewed 2425 times


Newbie

Posts

Joined
Fri Jul 22, 2011 12:03 pm

Post by mellowman79 » Sat Nov 24, 2012 2:49 am

If your uploading via FTP. You may run into the image loader not working in the admin panel. For some reason the jstree/jquery.tree.min.js doesn't retrieve the correct text or data. But what I did to fix the issues, was open the file in any text editor (notepad++) and replace the text with this file http://jstree.googlecode.com/svn-histor ... ree.min.js

Now my issue is resolved and file loader works perfectly. I found the error by using firebug, it was giving me this error ($("#column-left").tree) so I knew the problem had to lay in the Jquery code.

If you find this helpful please feel free to let me know.

Thanks

Newbie

Posts

Joined
Sat Nov 24, 2012 2:39 am

Post by squtternutbosh » Mon Nov 26, 2012 8:10 pm

Be interested to hear if Mellowman's solve worked for any one else...

New member

Posts

Joined
Tue Nov 01, 2011 10:11 pm

Post by squtternutbosh » Thu Nov 29, 2012 8:44 pm

Just to confirm, the best way around this i have found is to delete all images and upload in batches until it happens again and then you can see which image is causing the problem, this has happened on two sites now and this method solved each time, first site only had 200 images so reasonably simple but second site has over 1000 so was looking for an alternative but this method at least got it working again.

New member

Posts

Joined
Tue Nov 01, 2011 10:11 pm

Post by raxit4u2 » Fri Aug 02, 2013 5:28 pm

Make sure that there is no white space or any other char at the end of admin/index.php file. I had same problem and i found it has a problem with white space.

Newbie

Posts

Joined
Fri Aug 02, 2013 5:26 pm
Who is online

Users browsing this forum: No registered users and 16 guests