Post by jokermanx » Thu Jun 25, 2015 7:33 am

Well, i am trying to make 2 stores. i am going to do them with different themes, so i have created 2 opencart foldera:
i have created
../publick_html/myopencartsite
i installed opencart here
and when i have copyed everything from myopencartsite
../publick_html/myopencartsite/foto
creating new store in admin pannel and putting in store url ../publick_html/myopencartsite/foto/
So well, in my secondstore all the image link have http://.../foto/image/...
I dont really understand why. Can somebady explain it??
in my config i have define('DIR_IMAGE', '/home/u609004411/public_html/image/');
and not ('DIR_IMAGE', '/home/u609004411/public_html/foto/image/');
So why it is changing??

Newbie

Posts

Joined
Thu Jun 11, 2015 12:14 am

Post by deepvision » Thu Jun 25, 2015 12:24 pm

Code: Select all

creating new store in admin pannel and putting in store url ../publick_html/myopencartsite/foto/
This is not a valid store URL to put

Code: Select all

So well, in my secondstore all the image link have http://.../ foto/image/...
I dont really understand why. Can somebady explain it??
Because you have put your site under a foto folder. Site URLs and SRC attributes for images in browsers are relative to your site folder.
When you specify DIR_IMAGE in your config it is for the Opencart to know what folder to put the images to using php.
But the DIR_IMAGE cannot be used for URLs in browsers.

In older versions of opencart there was HTTP_IMAGE setting in config.php just for such situations. But it is no longer.

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by jokermanx » Thu Jun 25, 2015 6:25 pm

deepvision wrote:

Code: Select all

creating new store in admin pannel and putting in store url ../publick_html/myopencartsite/foto/
This is not a valid store URL to put

Code: Select all

So well, in my secondstore all the image link have http://.../ foto/image/...
I dont really understand why. Can somebady explain it??
Because you have put your site under a foto folder. Site URLs and SRC attributes for images in browsers are relative to your site folder.
When you specify DIR_IMAGE in your config it is for the Opencart to know what folder to put the images to using php.
But the DIR_IMAGE cannot be used for URLs in browsers.

In older versions of opencart there was HTTP_IMAGE setting in config.php just for such situations. But it is no longer.
Well, but in my model/image.php it is using like link "DIR_IMAGE . reltive_url_fro_DB" so is should give in the brauser full link without foto?? Or i dont know something about image getting mecanism??

Newbie

Posts

Joined
Thu Jun 11, 2015 12:14 am

Post by deepvision » Thu Jun 25, 2015 6:39 pm

I don't know what model/image.php you refer to but it uses DIR_IMAGE only to be able to get images and process them. DIR_IMAGE has nothing to do with how the final URL should look like.
What you need can be probably achieved with some extension.

Update: Also you can modify the code of your theme (in view folder) and add ../ to images src attributes.
Last edited by deepvision on Thu Jun 25, 2015 6:58 pm, edited 1 time in total.

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by jokermanx » Thu Jun 25, 2015 7:11 pm

deepvision wrote:I don't know what model/image.php you refer to but it uses DIR_IMAGE only to be able to get images and process them. DIR_IMAGE has nothing to do with how the final URL should look like.
What you need can be probably achieved with some extension.

Update: Also you can modify the code of your theme (in view folder) and add ../ to images src attributes.

Well, in opencart DB image link is saved like relative url.
When you are trying to get image url, for rist you are going to model/product, so you have relative url, when you are looking in your brauser you have full url, not realative, so where relative url is converted in full url??

Newbie

Posts

Joined
Thu Jun 11, 2015 12:14 am

Post by deepvision » Thu Jun 25, 2015 7:49 pm

catalog/model/tool/image.php:

Code: Select all

return $this->config->get('config_url') . 'image/' . $new_image;
which you should probably replace to

Code: Select all

return '/image/' . $new_image;
admin/model/tool/image.php:

Code: Select all

return HTTP_CATALOG . 'image/' . $new_image;
which you should probably replace to

Code: Select all

return '/image/' . $new_image;

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by jokermanx » Thu Jun 25, 2015 11:43 pm

deepvision wrote:catalog/model/tool/image.php:

Code: Select all

return $this->config->get('config_url') . 'image/' . $new_image;
which you should probably replace to

Code: Select all

return '/image/' . $new_image;
admin/model/tool/image.php:

Code: Select all

return HTTP_CATALOG . 'image/' . $new_image;
which you should probably replace to

Code: Select all

return '/image/' . $new_image;
Well thank you
it was
return MydefoultStore . '/image/' . $new_image;

Newbie

Posts

Joined
Thu Jun 11, 2015 12:14 am
Who is online

Users browsing this forum: No registered users and 4 guests