### Angular Module Setup
Source: https://pqina.nl/pintura/docs/v8/examples/image-preview
This TypeScript code sets up the main Angular module, importing necessary modules like BrowserModule and AngularPinturaModule, and declaring the AppComponent.
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularPinturaModule } from '@pqina/angular-pintura';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AngularPinturaModule],
exports: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
```
--------------------------------
### Angular Module Setup
Source: https://pqina.nl/pintura/docs/v8/api/ui/exports
Demonstrates the Angular module setup, including importing BrowserModule and AngularPinturaModule, and declaring the root component.
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularPinturaModule } from '@pqina/angular-pintura';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AngularPinturaModule],
exports: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
```
--------------------------------
### Angular Module Setup
Source: https://pqina.nl/pintura/docs/v8/api/exports
Demonstrates the Angular module setup, including importing BrowserModule and AngularPinturaModule, and declaring the root component.
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularPinturaModule } from '@pqina/angular-pintura';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AngularPinturaModule],
exports: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
```
--------------------------------
### Angular Pintura Module Setup
Source: https://pqina.nl/pintura/docs/v8/api/ui/exports
Shows the necessary imports and module setup for using Pintura within an Angular application via the `@pqina/angular-pintura` module.
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularPinturaModule } from '@pqina/angular-pintura';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AngularPinturaModule],
exports: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
```
--------------------------------
### Angular Component Setup
Source: https://pqina.nl/pintura/docs/v8/api/exports
Sets up an Angular component to use the Pintura editor, including default options and a custom toolbar rendering function.
```typescript
import { Component } from '@angular/core';
import { getEditorDefaults, findNode, PinturaNode } from '@pqina/pintura';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
editorDefaults: any = getEditorDefaults();
willRenderToolbar = (nodeList: any): PinturaNode[] => {
// So we can browse through the nodes in the developer console
console.log(nodeList);
// Find the export button
const exportButton = findNode('export', nodeList);
// Replace the label
exportButton[2].label = 'Save';
// Always show the label
exportButton[2].hideLabel = false;
return nodeList;
};
}
```
--------------------------------
### Angular Component Setup
Source: https://pqina.nl/pintura/docs/v8/api/ui/exports
Demonstrates how to set up an Angular component to use Pintura editor. It includes importing necessary modules, defining editor defaults, and a function to customize the toolbar.
```typescript
import { Component } from '@angular/core';
import { getEditorDefaults, findNode, PinturaNode } from '@pqina/pintura';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
editorDefaults: any = getEditorDefaults();
willRenderToolbar = (nodeList: any): PinturaNode[] => {
// So we can browse through the nodes in the developer console
console.log(nodeList);
// Find the export button
const exportButton = findNode('export', nodeList);
// Update the save property
updateNode(exportButton, { label: 'Save', hideLabel: false });
return nodeList;
};
}
```
--------------------------------
### Angular Component Setup
Source: https://pqina.nl/pintura/docs/v8/api/ui/exports
Sets up an Angular component to use the Pintura editor, including default options and a custom toolbar rendering function.
```typescript
import { Component } from '@angular/core';
import { getEditorDefaults, findNode, PinturaNode } from '@pqina/pintura';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
editorDefaults: any = getEditorDefaults();
willRenderToolbar = (nodeList: any): PinturaNode[] => {
// So we can browse through the nodes in the developer console
console.log(nodeList);
// Find the export button
const exportButton = findNode('export', nodeList);
// Replace the label
exportButton[2].label = 'Save';
// Always show the label
exportButton[2].hideLabel = false;
return nodeList;
};
}
```
--------------------------------
### Angular Component Setup
Source: https://pqina.nl/pintura/docs/v8/api/exports
Demonstrates how to set up an Angular component to use Pintura editor. It includes importing necessary modules, defining editor defaults, and a function to customize the toolbar.
```typescript
import { Component } from '@angular/core';
import { getEditorDefaults, findNode, PinturaNode } from '@pqina/pintura';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
editorDefaults: any = getEditorDefaults();
willRenderToolbar = (nodeList: any): PinturaNode[] => {
// So we can browse through the nodes in the developer console
console.log(nodeList);
// Find the export button
const exportButton = findNode('export', nodeList);
// Update the save property
updateNode(exportButton, { label: 'Save', hideLabel: false });
return nodeList;
};
}
```
--------------------------------
### Angular Module Setup
Source: https://pqina.nl/pintura/docs/v8/api/exports
Configures the main Angular module to include the Pintura editor module and the application component.
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularPinturaModule } from '@pqina/angular-pintura';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AngularPinturaModule],
exports: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
```
--------------------------------
### Angular Pintura Module Setup
Source: https://pqina.nl/pintura/docs/v8/api/exports
Configuration for the Angular module that integrates Pintura. It imports necessary modules like BrowserModule and AngularPinturaModule.
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularPinturaModule } from '@pqina/angular-pintura';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AngularPinturaModule],
exports: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
```
--------------------------------
### Angular Component for Pintura Editor
Source: https://pqina.nl/pintura/docs/v8/api/plugins/crop
This Angular component demonstrates how to use the Pintura editor with custom crop guides. It utilizes the `getEditorDefaults` function and defines a method `cropWillRenderImageSelectionGuides` to customize the rendering of image selection guides during different interactions like rotation.
```typescript
import { Component } from '@angular/core';
import { getEditorDefaults } from '@pqina/pintura';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
editorDefaults: any = getEditorDefaults();
cropWillRenderImageSelectionGuides = (
interaction: string,
interactionFraction: number
): { rows: number; cols: number; opacity: number } => {
const isRotating = interaction === 'rotate';
return {
rows: isRotating ? 5 : 3,
cols: isRotating ? 5 : 3,
opacity: interactionFraction * 0.25,
};
};
}
```
--------------------------------
### Angular Module Setup
Source: https://pqina.nl/pintura/docs/v8/api/ui/exports
Configures the main Angular module to include the Pintura editor module and the application component.
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularPinturaModule } from '@pqina/angular-pintura';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AngularPinturaModule],
exports: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
```
--------------------------------
### jQuery Image Preview Integration
Source: https://pqina.nl/pintura/docs/v8/examples/image-preview
This JavaScript code demonstrates how to integrate Pintura Image Editor using jQuery. It includes necessary script imports, sets up the editor on a div, and handles the image processing event to update an image tag.
```javascript
```
--------------------------------
### Angular Module Setup for Pintura
Source: https://pqina.nl/pintura/docs/v8/api/markup-editor/properties
Shows the necessary setup for the `AngularPinturaModule` within an Angular application's `AppModule`. This ensures that the Pintura editor components are available for use.
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularPinturaModule } from '@pqina/angular-pintura';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AngularPinturaModule],
exports: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
```
--------------------------------
### Angular Module Setup
Source: https://pqina.nl/pintura/docs/v8/api/image-editor/properties
Configures the main Angular module to include the Pintura editor functionality. It imports BrowserModule and AngularPinturaModule, and declares the AppComponent.
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularPinturaModule } from '@pqina/angular-pintura';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AngularPinturaModule],
exports: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
```
--------------------------------
### Angular Module Setup for Pintura
Source: https://pqina.nl/pintura/docs/v8/api/plugins/crop
This Angular module configuration sets up the application to use Pintura. It imports `BrowserModule` and `AngularPinturaModule`, declares the `AppComponent`, and specifies `AppComponent` as the bootstrap component.
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularPinturaModule } from '@pqina/angular-pintura';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AngularPinturaModule],
exports: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
```
--------------------------------
### HTML Structure and jQuery Integration for Pintura
Source: https://pqina.nl/pintura/docs/v8/api/plugins/crop
This HTML file sets up the basic structure for using Pintura with jQuery. It includes the necessary Pintura CSS and JavaScript files, along with jQuery and a Pintura jQuery adapter. It then initializes the Pintura editor on a div with the ID 'editor' and customizes the crop guides.
```html
```
--------------------------------
### Angular Module Setup
Source: https://pqina.nl/pintura/docs/v8/api/image-editor/exports
Configures the Angular module to use the Pintura editor. It imports necessary modules like BrowserModule and AngularPinturaModule, declares the AppComponent, and bootstraps the application with AppComponent.
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularPinturaModule } from '@pqina/angular-pintura';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AngularPinturaModule],
exports: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
```
--------------------------------
### Svelte Sticker Configuration
Source: https://pqina.nl/pintura/docs/v8/api/markup-editor/stickers
Illustrates how to use Pintura stickers within a Svelte component. This example shows the basic structure for integrating the editor and configuring stickers.
```svelte
```
--------------------------------
### Angular Component Styles
Source: https://pqina.nl/pintura/docs/v8/examples/image-preview
This CSS code provides styling for the Pintura editor within an Angular application, specifically setting the height of the editor element.
```css
::ng-deep .pintura-editor {
height: 600px;
}
```
--------------------------------
### Angular Module Setup for Pintura
Source: https://pqina.nl/pintura/docs/v8/api/markup-editor/exports
Illustrates the `AppModule` configuration for integrating Pintura into an Angular project. It imports `BrowserModule`, `AppComponent`, and `AngularPinturaModule`.
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularPinturaModule } from '@pqina/angular-pintura';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AngularPinturaModule],
exports: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
```
--------------------------------
### React Sticker Configuration
Source: https://pqina.nl/pintura/docs/v8/api/markup-editor/stickers
Shows how to integrate Pintura's sticker functionality within a React application. It utilizes the `PinturaEditor` component and demonstrates the same advanced sticker configuration as the JavaScript example.
```jsx
import '@pqina/pintura/pintura.css';
import './App.css';
import { PinturaEditor } from '@pqina/react-pintura';
import { getEditorDefaults, Sticker } from '@pqina/pintura';
const editorDefaults = getEditorDefaults();
function App() {
return (
);
}
export default App;
// Basic CSS for the editor
// .pintura-editor { height: 600px; }
```
--------------------------------
### Angular Image Preview Component
Source: https://pqina.nl/pintura/docs/v8/examples/image-preview
This TypeScript code defines an Angular component for the Pintura Image Editor. It configures editor defaults, handles the image processing event, and sanitizes the output URL for display.
```typescript
import { Component } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { getEditorDefaults } from '@pqina/pintura';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
constructor(private domSanitizer: DomSanitizer) {}
editorResult?: string = undefined;
editorDefaults: any = getEditorDefaults({
imageWriter: {
targetSize: {
width: 256,
height: 256,
},
},
});
handleEditorProcess(imageState: any): void {
this.editorResult = (
this.domSanitizer.bypassSecurityTrustResourceUrl(
URL.createObjectURL(imageState.dest)
)
);
}
}
```
--------------------------------
### Custom CSS for Pintura Editor
Source: https://pqina.nl/pintura/docs/v8/api/image-editor/exports
Applies custom styles to the Pintura editor component using CSS. This example sets a fixed height for the editor.
```css
::ng-deep .pintura-editor {
height: 600px;
}
```
--------------------------------
### Angular Module Setup for Pintura
Source: https://pqina.nl/pintura/docs/v8/api/image-editor/events
Shows the NgModule configuration for an Angular application that uses Pintura. It imports necessary modules like BrowserModule, AngularPinturaModule, and declares the AppComponent.
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularPinturaModule } from '@pqina/angular-pintura';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AngularPinturaModule],
exports: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
```
--------------------------------
### Angular Image Preview Template
Source: https://pqina.nl/pintura/docs/v8/examples/image-preview
This HTML template is used with the Angular component. It conditionally displays the processed image and includes the Pintura editor component, binding its options and handling the process event.
```html
```
--------------------------------
### Angular Template for Pintura Editor
Source: https://pqina.nl/pintura/docs/v8/api/plugins/crop
This is the Angular template snippet that integrates the Pintura editor into the application. It binds the editor options and the custom crop guide rendering function to the `pintura-editor` component.
```html
```
--------------------------------
### Vue Sticker Configuration
Source: https://pqina.nl/pintura/docs/v8/api/markup-editor/stickers
Provides an example of implementing Pintura stickers in a Vue.js application. It uses the `PinturaEditor` component and configures stickers within the component's data properties.
```vue
```
--------------------------------
### jQuery Pintura Editor Integration
Source: https://pqina.nl/pintura/docs/v8/api/markup-editor/properties
Provides an example of integrating the Pintura editor using jQuery. It includes setting up the editor with custom options and the `willRenderShapeControls` callback for manipulating shape controls.
```html
```
--------------------------------
### jQuery Pintura Editor Load Progress Event
Source: https://pqina.nl/pintura/docs/v8/api/image-editor/events
This snippet demonstrates how to initialize and handle the 'loadprogress' event for the Pintura image editor using jQuery. It includes the necessary script includes and event listener setup.
```javascript
```
--------------------------------
### jQuery Pintura Editor Integration
Source: https://pqina.nl/pintura/docs/v8/api/image-editor/properties
Demonstrates initializing the Pintura image editor using jQuery. It includes loading necessary scripts, setting up the editor with image source, rotation, and crop properties.
```javascript
```
--------------------------------
### jQuery Pintura Editor Integration
Source: https://pqina.nl/pintura/docs/v8/api/exports
Demonstrates how to initialize and use the Pintura editor with jQuery. It includes loading necessary scripts, setting up the editor with custom options, and adding a custom node to the toolbar.
```html
```
--------------------------------
### Pintura Editor Initialization and Event Handling (HTML/JavaScript)
Source: https://pqina.nl/pintura/docs/v8/api/markup-editor/events
Initializes the Pintura editor with a default configuration and demonstrates how to subscribe to the 'pintura:addshape' event to log shape details. Includes necessary script and style includes.
```html
```
--------------------------------
### Pintura Markup Editor Initialization and Event Handling
Source: https://pqina.nl/pintura/docs/v8/api/markup-editor/events
Initializes the Pintura Markup Editor using jQuery and demonstrates how to listen for the 'pintura:tapshape' event.
```html
```
--------------------------------
### jQuery Editor Integration
Source: https://pqina.nl/pintura/docs/v8/api/exports
Illustrates how to initialize and use the Pintura editor with jQuery. It includes loading necessary scripts, setting up the editor with options, and customizing the toolbar.
```javascript
```
--------------------------------
### jQuery Pintura Editor Integration
Source: https://pqina.nl/pintura/docs/v8/api/ui/exports
Demonstrates integrating the Pintura editor using jQuery. It includes loading necessary scripts and initializing the editor with custom toolbar rendering logic.
```html
```
--------------------------------
### Pintura Editor Styling in Angular
Source: https://pqina.nl/pintura/docs/v8/api/markup-editor/exports
Provides CSS to style the Pintura editor component within an Angular application. This example uses `::ng-deep` to apply a specific height to the editor.
```css
::ng-deep .pintura-editor {
height: 600px;
}
```
--------------------------------
### jQuery Editor Integration
Source: https://pqina.nl/pintura/docs/v8/api/ui/exports
Illustrates how to initialize and use the Pintura editor with jQuery. It includes loading necessary scripts, setting up the editor with options, and customizing the toolbar.
```javascript
```
--------------------------------
### jQuery Image Editor Integration
Source: https://pqina.nl/pintura/docs/v8/api/image-editor/exports
Shows how to initialize and use the Pintura Image Editor with jQuery. It includes loading necessary scripts, setting up the editor with custom options like image writing, and applying styles.
```html
```
--------------------------------
### Plain HTML with jQuery Integration
Source: https://pqina.nl/pintura/docs/v8/api/exports
Integrates the Pintura editor into a plain HTML page using jQuery. It includes script tags for Pintura and jQuery, and demonstrates initializing the editor with custom toolbar logic.
```html
```
--------------------------------
### Plain HTML with jQuery Integration
Source: https://pqina.nl/pintura/docs/v8/api/ui/exports
Integrates the Pintura editor into a plain HTML page using jQuery. It includes script tags for Pintura and jQuery, and demonstrates initializing the editor with custom toolbar logic.
```html
```
--------------------------------
### Angular Pintura Editor Component
Source: https://pqina.nl/pintura/docs/v8/api/exports
Demonstrates how to set up and use the Pintura editor within an Angular component. It shows default editor options, custom toolbar rendering logic, and how to append custom nodes.
```typescript
import { Component } from '@angular/core';
import {
getEditorDefaults,
createNode,
appendNode,
PinturaNode,
} from '@pqina/pintura';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
editorDefaults: any = getEditorDefaults();
willRenderToolbar = (nodeList: any): PinturaNode[] => {
// So we can browse through the nodes in the developer console
console.log(nodeList);
// Adds a node to the end of the nodeList
appendNode(
createNode('div', 'my-div', {
textContent: 'Hello World',
}),
nodeList
);
return nodeList;
};
}
```
--------------------------------
### Angular Pintura Editor Integration
Source: https://pqina.nl/pintura/docs/v8/api/ui/exports
Demonstrates how to integrate the Pintura editor into an Angular application. It shows how to use `getEditorDefaults` for options and `willRenderToolbar` to manipulate the toolbar nodes.
```typescript
import { Component } from '@angular/core';
import {
getEditorDefaults,
createNode,
appendNode,
PinturaNode,
} from '@pqina/pintura';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
editorDefaults: any = getEditorDefaults();
willRenderToolbar = (nodeList: any): PinturaNode[] => {
// So we can browse through the nodes in the developer console
console.log(nodeList);
// Adds a node to the end of the nodeList
appendNode(
createNode('div', 'my-div', {
textContent: 'Hello World',
}),
nodeList
);
return nodeList;
};
}
```
```html
```
--------------------------------
### JavaScript Sticker Configuration
Source: https://pqina.nl/pintura/docs/v8/api/markup-editor/stickers
Demonstrates how to configure custom stickers using plain JavaScript with the Pintura editor. It shows the structure for defining sticker thumbnails, alternative text, and shape properties like dimensions and background images.
```javascript
import { appendDefaultEditor, Sticker } from './pintura.js';
const editor = appendDefaultEditor('#editor', {
src: 'image.jpeg',
stickers: [
// Advanced Sticker configuration
// - `thumb` is used as the thumbnail for the sticker list
// - `backgroundImage` is used for the sticker
// - The editor will use the shape `width`, `height`, and `aspectRatio`
{
thumb: './stickers/logo.png', // can also be an Emoji
alt: 'Firefox logo',
shape: {
// a shape definition, the position of the sthape will be set by the editor
width: 100,
height: 100,
aspectRatio: 1,
backgroundImage: './stickers/logo-high-resolution.png',
},
},
],
});
// Basic CSS for the editor
// .pintura-editor { height: 600px; }
```
--------------------------------
### Angular Editor Integration
Source: https://pqina.nl/pintura/docs/v8/api/exports
Shows how to use the Pintura editor component within an Angular template, binding editor options and the custom toolbar rendering function.
```html
```
--------------------------------
### Angular HTML Template
Source: https://pqina.nl/pintura/docs/v8/api/exports
The HTML template for an Angular application, demonstrating how to bind Pintura editor options and the custom toolbar function.
```html
```
--------------------------------
### Angular HTML Template
Source: https://pqina.nl/pintura/docs/v8/api/ui/exports
The HTML template for an Angular application, demonstrating how to bind Pintura editor options and the custom toolbar function.
```html
```
--------------------------------
### jQuery Integration with Pintura Markup Editor
Source: https://pqina.nl/pintura/docs/v8/api/markup-editor/exports
Demonstrates integrating the Pintura Markup Editor using jQuery. It includes setting up the editor with default options, custom shape style controls, and font family options, along with basic styling.
```javascript
```