Page 1 of 1

Unable to embed Images in Information page?

Posted: Mon May 11, 2015 5:14 pm
by ASG
For affiliate program for my site, I was looking to add an information page where I can display banners for my site's affiliates. However, I've run into a problem that I'm unable to embed any images at all in the information pages.

I'm using CKEditor, and when clicking on insert image icon, and after selecting the image, the WYSIWYG editor goes blank where the image should be, however, the code shows the image as embedded.

Any ideas what's going on??

Re: Unable to embed Images in Information page?

Posted: Tue May 12, 2015 7:32 am
by IP_CAM
Have you uploaded the latest CKeditor available in the Extension Section?

Re: Unable to embed Images in Information page?

Posted: Tue May 12, 2015 4:53 pm
by ASG
Yes, the CKEditor is the latest version.

Here are how images looking in the Opencart file manager(no preview in thumbnails)

http://awesomescreenshot.com/0634wgta40

And this is how it looks once the image has been inserted(there is no image in the preview section)

http://awesomescreenshot.com/0004wgt962

Apparently, all of the images on the server(even images for live products) lead to the same result.

Re: Unable to embed Images in Information page?

Posted: Fri May 15, 2015 1:15 am
by ASG
BUMP! :-\

Re: Unable to embed Images in Information page?

Posted: Fri May 15, 2015 2:20 am
by IP_CAM
You gave me a hard time to find out, I knew, I had it done, but, obviously, I missed something.
I did NOT add the Image Routine into the ADMIN Sub 'image.php' file as well... :-\

So, to make sure, in:
catalog\model\tool\image.php
( Line 39 to line 59, the last: '?>' END of the Code)

replace, what you have, starting with this:
list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);
with this:

Code: Select all

			list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);

			if ($width_orig != $width || $height_orig != $height) {
				$image = new Image(DIR_IMAGE . $old_image);
				$image->resize($width, $height, $type);
				$image->save(DIR_IMAGE . $new_image);
			} else {
				copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
			}
		}
		
		if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
			// return $this->config->get('config_ssl') . 'image/' . $new_image;
			return HTTPS_IMAGE . $new_image;
		} else {
			// return $this->config->get('config_url') . 'image/' . $new_image;
			return HTTP_IMAGE . $new_image;
		}	
	}
}
?>
THEN, in:
admin\model\tool\image.php
( Line 33 to line 42, the last: '?>' END of the Code)

replace, what you have, with this:

Code: Select all

		if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
			// return $this->config->get('config_ssl') . 'image/' . $new_image;
			return HTTPS_IMAGE . $new_image;
		} else {
			// return $this->config->get('config_url') . 'image/' . $new_image;
			return HTTP_IMAGE . $new_image;
		}	
	}
}
?>
Then, you can set your image URL's and Image Path, wherever you like to, in BOTH config.php Files, i.E., internally, or to a remote Image Subdomain Name, and it will work.
Good Luck
Ernie
bigmax.ch/os/

Re: Unable to embed Images in Information page?

Posted: Fri May 15, 2015 12:07 pm
by ASG
Thanks for the reply IP_Cam.

However, all of the code was already existing the files.
The only difference were these lines in the code, which I replaced, to find even the working images on store front-end & admin getting broke(and not being displayed)

Code: Select all

         // return $this->config->get('config_ssl') . 'image/' . $new_image;
         return HTTPS_IMAGE . $new_image;
      } else {
         // return $this->config->get('config_url') . 'image/' . $new_image;
         return HTTP_IMAGE . $new_image;
This is what it looks like right now after reverting to normal. Commented lines were the modifications you had suggested.

Re: Unable to embed Images in Information page?

Posted: Sat May 16, 2015 3:00 am
by IP_CAM
>>> The only difference were these lines in the code, <<<
it's a very important Difference, it makes ALL the difference in the world! ;)

BUT, since you have not configured your config.php files, as mentioned above, accordingly, it did not work!

If you set the IMAGE-LINKS+PATHS in BOTH of the 2 config.php,
the one in the Server ROOT and the one in the ADMIN Sub,
according the Content below, if will work.
If ANY Image-related, Line is (still) missing, in your ROOT config.php,
Copy the one of this File, or then the already 'rewritten' Line of the admin-config.php,
and make sure, they both will MATCH the 'Values' like Path, or Link, to your Server files.

Code: Select all

// HTTP
define('HTTP_SERVER', 'http://www.YOURS.COM/shop/admin/');
define('HTTP_CATALOG', 'http://www.YOURS.COM/shop/');
define('HTTP_IMAGE', 'http://www.YOURS.COM/shop/image/');

// IF IMAGE SUB-DOMAIN USED, 'unquote' line below and quote line above this Line.
// define('HTTP_IMAGE', 'http://images.YOURS.COM/shop/image/');

// HTTPS
define('HTTPS_SERVER', 'http://www.YOURS.COM/shop/admin/');
define('HTTPS_CATALOG', 'http://www.YOURS.COM/shop/');
define('HTTPS_IMAGE', 'http://www.YOURS.COM/shop/image/');

// IF IMAGE SUB-DOMAIN USED, 'unquote' line below and quote line above this Line.
// define('HTTPS_IMAGE', 'http://images.YOURS.COM/shop/image/');

// YOUR SERVER PATH WILL LOOK DIFFERENT, I KNOW! Take it as sample:
// DIR 
define('DIR_APPLICATION', '/home/YOURS/www/YOURS_COM/shop/admin/');
define('DIR_SYSTEM', '/home/YOURS/www/YOURS_COM/shop/system/');
define('DIR_DATABASE', '/home/YOURS/www/YOURS_COM/shop/system/database/');
define('DIR_LANGUAGE', '/home/YOURS/www/YOURS_COM/shop/admin/language/');
define('DIR_TEMPLATE', '/home/YOURS/www/YOURS_COM/shop/admin/view/template/');
define('DIR_CONFIG', '/home/YOURS/www/YOURS_COM/shop/system/config/');

// THIS ONE:
define('DIR_IMAGE', '/home/YOURS/www/YOURS_COM/shop/image/');
// ABOVE LINE

define('DIR_CACHE', '/home/YOURS/www/YOURS_COM/shop/system/cache/');
define('DIR_DOWNLOAD', '/home/YOURS/www/YOURS_COM/shop/download/');
define('DIR_LOGS', '/home/YOURS/www/YOURS_COM/shop/system/logs/');
define('DIR_CATALOG', '/home/YOURS/www/YOURS_COM/shop/catalog/');
Good Luck
Ernie
bigmax.ch/os/

Re: Unable to embed Images in Information page?

Posted: Sat May 16, 2015 1:00 pm
by ASG
Those lines are already there in the config files. Check PM. The store has been running for about 6 months now, and this is the only issue I've had to face with the images.

Re: Unable to embed Images in Information page?

Posted: Sat May 16, 2015 11:42 pm
by IP_CAM
I would advise you to update your OC-Editor, before trying anything else.
And make sure, to (if so...) ADD any image Links IN SOURCE-MODE, not WysiwWyg...!
I use this One below, linked, from best-byte
http://www.ipc.li/os/ckeditor-4_3-full.zip
http://www.opencart.com/index.php?route ... n_id=13753

Others available:
http://www.opencart.com/index.php?route ... n_id=10032
http://www.opencart.com/index.php?route ... n_id=12281
http://www.opencart.com/index.php?route ... n_id=21159
Let me know!
Ernie

Re: Unable to embed Images in Information page?

Posted: Sun May 17, 2015 5:46 am
by IP_CAM
UPDATE: Just changing CKEDITOR Versions, seemengly does not help.

It's the CKeditor, it has no DEFAULT selection Config-Option to REWRITE the 'entire' SERVER - BASEPATH, or for image-href-links, so, it's rather inflexible, when it comes to address other than the DEFAULT Image Directory. I looked for some time, but found nothing , but lot's of different succestions, and information, not resulting in anything usable, to make it work on my test Site.

But for Info-Pages, and such, it's still not a Problem, if you only use a few images. Just do it, as shown below!
At least, until we find a working solution to REROUTE the CKEditor address-Path/link.

Ernie
I placed an image in each info page:
http://www.bigmax.ch/os/

Re: Unable to embed Images in Information page?

Posted: Sun May 17, 2015 2:15 pm
by ASG
Thanks a lot for your help IP_CAM

Moved the images to default image directory, and they are getting embedded now. Apparently, if you want to embed images from sub-directories into the information pages, you can't do it.

Re: Unable to embed Images in Information page?

Posted: Mon May 18, 2015 5:31 am
by IP_CAM
At least, you solved your problem, I did not. Yet. I worked the whole night, trying configurations, and different CKEditor Versions, ending up in plain frustration. Uncounted Postings exist to the Theme, but not a single one helped...! :-\

I need that stuff to find out, because I work with an 'Image Subdomain', and my Image Handler takes the image-link out of the 'Image Subdomain', and the CKEditor makes creates it's own Image File out of it, but does NOT place it in the LOCAL Image directory. Probably, it's directed to another path by the config.php. As a consequence of this, I end up with no image visible. :choke:

I have to find a better solution, but manually to copy/paste Links, as described above.
Once I get the Server-Path, as default-defined by CKEditor, to start from Server ROOT, not from Shop ROOT, my Problem will be solved, because, set as path, I have all my Sites/Files within the same Server Path. :)

Good Luck, anyway!
Ernie

Re: Unable to embed Images in Information page?

Posted: Mon May 18, 2015 12:01 pm
by ASG
Well, it is a temporary fix for me too. I use a image subdomain too. The thing is I don't have much requirement for embedding the images in Info pages on my site, that is why moving 4-5 images to root image directory works. I know I will have a problem when I want more of these images in my information pages.

Re: Unable to embed Images in Information page?

Posted: Tue Jun 16, 2015 12:43 am
by Cleo
Did you follow the instructions in this thread from Qphoria?

http://forum.opencart.com/viewtopic.php?f=138&t=40573

I use sub-domain for my images and I have no problem to insert them in information page. I added one at the bottom of this page.

http://www.lesbricollesdecleo.com/delivery-information

Cleo

Re: Unable to embed Images in Information page?

Posted: Tue Jun 16, 2015 1:02 am
by IP_CAM
We where just talking about the Image Managers, built into to OC, they do NOT
using the REMOTE IMAGE Address, quoted in the config.php's, but always PRESET
the Shop Site URL only. So, I have to exchange it manually, by re-linking (Shop-related) images to the
Image Subdomain URL >http://images/openshop.li/....<, I found no FAST WAY to change it.

Ernie
bigmax.ch/os/