Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image Manipulation Class #2498

Closed
Henqsan opened this issue Jan 18, 2020 · 1 comment
Closed

Image Manipulation Class #2498

Henqsan opened this issue Jan 18, 2020 · 1 comment

Comments

@Henqsan
Copy link

Henqsan commented Jan 18, 2020

Hello!

I am trying to implement the image manipulation library in my controller. But when I try to use the base_url() path, the library cannot find the path!

$path_save = base_url('assets/images/test.jpg');

            $image = \Config\Services::image()
           ->withFile($image_file->getTempName())
           ->fit(100, 100, 'center')
           ->save($path_save);

What is the difference in using the path to the directory where the image will be saved like this:

base_url('assets/images/test.jpg')

and this way:

'../public/assets/images/test.jpg'

Is there a correct way to indicate the directory path to save the image?

@MGatner
Copy link
Member

MGatner commented Jan 18, 2020

Support questions belong on the forums. Briefly: public/ should not be part of your URL path - you should be serving it as your root such that the image would be at "http://example.com/assets/images/test.jpg". If you cannot modify the web server you need to use .htaccess or equivalent to adjust the path.

@MGatner MGatner closed this as completed Jan 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants