1

There is something about Magento2 that troubles me so much.

When I have a website on production mode and I need to make a simple image change how I can do it?

I thought changing the image via FTP will work (with the same filename), but seems it doesn't. The image doesn't change on frontend.

Reading this question: Why static files are not generated or cached in Default or Production mode in Magento 2?

I understand on production mode the statics files are not generated until you run the command...

But then I did some tests on local that confuses me more, I set the magento on production mode, and it works fine! I change and image and when I refresh the browser the image changes. I use this VM: https://bitnami.com/stack/magento/virtual-machine

So what is happening? I understand the production mode does not generate static files, but I only replacing the images... so maybe it doesn't need to regenerate.

So the only way to make this change that I know is deleting pub/static/* and running the static-content:deploy command. Then it works, all is deleted and regenerated, but this is really annoying when you have a website that is on live. Really we have to stop the website for changing a SIMPLE image?

And another thing is, this tasks about changing images, usually, will do it a person who doesn't know about programming, so he never touched a terminal and probably never will do it.

The fun fact is that on developer mode it has this button: Flush Static Files Cache. Really? why a developer needs this? Who really needs this is a person who doesn't have access on terminal and knows nothing about computers.

0

This is more of a rant than a question, but I'll try. The goal of just changing a single image is possible to achieve. I don't think most users would recommend this, but I have done it a couple times with no problems out of the same concerns you raise.

First, you must change the image in your theme so that next time you generate static files, your change is maintained. This is the image in your app/design/frontend/Namespace/Theme/....

Next, override the generated file. This is usually easy to find from the frontend, as the image path will reflect where it is in the pub/static directory.

I think the rest of your question is about why this is the way it is. I can't quote a source, but it seems to me that the speed benefits of having static content generated greatly outweigh the cost of having to generate the content once. Developer mode is rather slow as I'm sure you know. I typically time my site updates with my web traffic, but there are more advanced strategies for reducing downtime.

I haven't looked into this much yet, but magento 2.2.0 included a new feature called Pipeline Deployment which may suit you better:

Pipeline deployment, a new deployment process, enables build and deployment stages to minimize production system downtime for site updates. Resource-intensive processes can run on the build server. Pipeline deployment supports easy management of configuration between environments, too. Read more about pipeline deployment here.

  • Well, but the problem is, this way of changing an image will do it a person who doesn't know about computers, he probably never used a terminal. – slayerbleast Feb 12 '18 at 8:35
  • So have someone who is capable of doing the task do the task? Maybe you can find a theme that has a UI for changing images, otherwise I think you're out of luck. – jamil Feb 12 '18 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.