Adding and Removing Media Images Programmatically in Magento 2

This post will describe the process of adding and removing media images programmatically in Magento 2 using the Magento_Catalog module classes. Usually when developers need to programmatically add and remove product images, it requires a one-off script to be run. Therefore the code shown will reside in a single file that externally bootstraps the Magento ...

Backup Code and Databases with Amazon S3

Amazon S3 is one of the most supported cloud storage service available. With Amazon AWS offering a ‘free tier’ package, many users take advantage of the free 5GB storage available from the S3 service. Using the AWS CLI, you can backup code and databases with Amazon S3.
In order to use AWS CLI commands, you ...

Fixing the ‘wysiwyg is not under storage root path’ error in Magento 2

If the media directory within your Magento 2 application is being used as a symlink, then there is a chance you may have encountered an issue with uploading media images in the admin. The error in question is as follows: /your/symlinked/mediadir/wysiwyg is not under storage root path. This post will describe steps to take in ...

Converting SVG files to PNG

Many CMS applications do not allow an .svg as an allowed file type to be uploaded as a media image, such as for the site logo. This post will demonstrate how to go about converting SVG files to PNG format using JavaScript.
Firstly, open the SVG file to be converted in a browser and copy ...

Configuring a MySQL Database with Valet Plus

In the previous post, you were shown how to get started with Valet Plus. What wasn’t covered were steps involving configuring a MySQL database with Valet Plus.
By default, Valet+ comes installed with MySQL version 5.7 with compatibility for version 5.6. According to the documentation, Valet+ also includes a tweaked my.cnf which is aimed at ...

Getting Started with Valet Plus

Valet Plus is a development environment for macOS systems based off of the popular Laravel Valet package. From the Valet Plus documentation on Github, Valet+ configures your Mac to always run Nginx in the background when your machine starts. Then, using DnsMasq, Valet+ proxies all requests on the *.test domain to point to sites installed ...

Add a Dynamic Route in the Magento 2 Admin

Many Magento 2 extensions, like blog modules, allow merchants to configure the URL of the page in the admin within the Stores -> Configuration area. Developers can add this functionality by adding a custom Magento 2 Router class allowing the merchant to add a dynamic route in the Magento 2 admin.
Below will describe the ...

Sample Nginx Configuration for Magento 1

Below you can view sample Nginx configuration for Magento 1 applications.
Note: This article is based on Magento Community/Open Source version 1.9.

Sample Nginx Configuration for Magento 2

Below you can view sample Nginx configuration for Magento 2 applications. For security reasons, you should ensure that the Magento 2 document root is set to the pub subdirectory to protect root directory assets, such as the app directory.
Note: This article is based on Magento Open Source version 2.2.4.

Wrong Webroot with Atomic Deployments and PHP FPM

If using Nginx and PHP FPM as a web server solution, then you might have experienced a strange issue involving atomic deployment strategies for your web application.
Atomic deployment solutions, such as Capistrano, create a symlink to the current application release directory. When a new deployment takes place, Capistrano simply updates the symlink to ...