Comments (10)
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.
Can this solution work? - https://github.com/niklasvh/html2canvas/
from phpagebuilder.
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.
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.
Can this solution work? - https://github.com/niklasvh/html2canvas/
I realized that this is already present.
from phpagebuilder.
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.
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.
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.
Thanks! I'll watch it
from phpagebuilder.
You're welcome
from phpagebuilder.
Related Issues (20)
- Important note: how to add static module which get data from database?
- How to clear blocks cache?
- Missing usage references with Framework Laminas
- SQLSTATE[42S22]: Column not found: 1054 Unknown column 'setting' in 'field list'
- Save as plain html in database
- I created a code editing plugin if you want to use it HOT 1
- How can I get Grapejs default block components inside my block HOT 3
- PHP 8.0+ HOT 1
- Index.php HOT 1
- error after installation HOT 1
- CKEditor 4 End of Life
- Pagebuilder is stuck on loading
- image options
- admin Not Found HOT 5
- need help with adjustments!!!
- Documentation guide incomplete
- Integration into Symfony
- PHP 8 HOT 1
- Creating multiple columns where the user can drag blocks in.
- Update my settings based on how many elements are inside the block
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpagebuilder.