Giter VIP home page Giter VIP logo

Comments (10)

HansSchouten avatar HansSchouten commented on August 21, 2024

In this specific screenshot I am using PHPageBuilder in combination with Laravel which runs a scheduled task every minute which renders missing/updated blocks using https://github.com/spatie/browsershot.

This is however difficult to integrate into the PHPageBuilder core, which I try to keep as basic as possible. However there is a button on the settings page (/admin?route=settings) which uses iframes, html5 canvas and an ajax request to render the blocks. These are not exactly the same as actual screenshots, but at the moment the best I can do with the least amount of code (I am of course open to other suggestions).

As soon as possible I will create a much more thorough documentation and also reference the exact code I used to generate the screenshots in Laravel. If you are interested I can already share a pastebin.

from phpagebuilder.

Vanguger avatar Vanguger commented on August 21, 2024

Can this solution work? - https://github.com/niklasvh/html2canvas/

from phpagebuilder.

Vanguger avatar Vanguger commented on August 21, 2024

As an option, if the engine will show the: blocks/name/thumb.jpg if it exists. This allows to add a screenshot yourself and it will load automatically.

from phpagebuilder.

Vanguger avatar Vanguger commented on August 21, 2024

I did it like this:

    // ThemeBlock.php  line 151
    public function getThumbPathImg(){
        return $this->theme->getFolder() . '/public/block-thumbs/' . $this->blockSlug . '.jpg';
    }
    
    public function getThumbUrlImg(){
        return phpb_theme_asset('public/block-thumbs/' . $this->blockSlug . '.jpg');
    }
        //BlockAdapter.php line 92
        if (file_exists( $this->block->getThumbPathImg() )){
            $img = '<div class="block-thumb"><img src="' . $this->block->getThumbUrlImg() . '"></div>';
        }

It works. But what is your decision and thoughts about this?

from phpagebuilder.

Vanguger avatar Vanguger commented on August 21, 2024

Can this solution work? - https://github.com/niklasvh/html2canvas/
I realized that this is already present.

from phpagebuilder.

Vanguger avatar Vanguger commented on August 21, 2024

In this specific screenshot I am using PHPageBuilder in combination with Laravel which runs a scheduled task every minute which renders missing/updated blocks using https://github.com/spatie/browsershot.

This is however difficult to integrate into the PHPageBuilder core, which I try to keep as basic as possible. However there is a button on the settings page (/admin?route=settings) which uses iframes, html5 canvas and an ajax request to render the blocks. These are not exactly the same as actual screenshots, but at the moment the best I can do with the least amount of code (I am of course open to other suggestions).

As soon as possible I will create a much more thorough documentation and also reference the exact code I used to generate the screenshots in Laravel. If you are interested I can already share a pastebin.

Yes, I'm definitely interested.

from phpagebuilder.

HansSchouten avatar HansSchouten commented on August 21, 2024

As an option, if the engine will show the: blocks/name/thumb.jpg if it exists. This allows to add a screenshot yourself and it will load automatically.

Yes I was thinking about that as well. I started off with icons, but after 10 blocks I noticed spending more time scrolling through icon lists than building blocks (icons still work btw). And to me it would be really great to be able to build websites as quickly as: buying a html5 theme, cutting it in pieces (blocks), dragging a few blocks on pages, sending login credentials to a friend/customer, done. Also creating manual screenshots is a time overhead (especially if you change the blocks from time to time). Currently the image path contains a hash of the block's content. So any time the block view file changes, it now knows it needs a new image. However, we can use a hybrid solution that first checks whether a thumb.jpg exists and if not it checks for the screenshot based on view file contents.

from phpagebuilder.

HansSchouten avatar HansSchouten commented on August 21, 2024

Yes, I'm definitely interested.

Since it requires code in multiple files, I added them to this repo: https://github.com/HansSchouten/PHPageBuilder-Laravel-Screenshots

from phpagebuilder.

Vanguger avatar Vanguger commented on August 21, 2024

Thanks! I'll watch it

from phpagebuilder.

HansSchouten avatar HansSchouten commented on August 21, 2024

You're welcome

from phpagebuilder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.