Photo layout editor for react

Overview

react-photo-layout-editor

logo

사진 레이아웃을 편집하는 웹 프로그램입니다.
This is photo layout editor for react

예전 Instagram blog( http://blog.instagram.com/ )에 있는 정렬된 이미지의 모습에 매료되어 저런 모습을 직접 편집하여 게시물로 올렸으면 좋겠다는 생각이 들어 만들게 되었습니다.
블럭을 드래그 앤 드롭으로 위치와 크기를 편집하여 모던하게 정렬된 이미지나 레이아웃 만들 수 있습니다.

logo

Demo

다음 링크를 통하여 기능을 체험해볼 수 있습니다.

https://redgoose-dev.github.io/react-photo-layout-editor/

Feature

PLE는 이런 특징들을 가지고 있습니다.

Management Images

사이드바에 이미지를 업로드하여 사진을 배치하기 전에 이미지를 담아둘 수 있습니다.

screen

Edit Blocks

블럭의 갯수나 사이즈, 여백등을 조절할 수 있습니다.

grid editor

Drag & Drop

이미지를 드래그하여 이미지를 블럭에 넣거나 블럭의 위치를 옮기거나 수정할 수 있습니다.

Edit image area

블럭을 선택하고 펜 모양의 툴바(edit block)를 선택하면 편집창이 뜨면서 영역을 변경할 수 있습니다.

cropper

Change color

블럭의 배경색을 바꿀 수 있습니다. 빈 블럭을 만들고 색상을 수정할 수 있습니다.

change color

Installation

cli로 설치할 프로젝트에서 다음과 같은 명령을 실행합니다.

npm

npm install --save react-photo-layout-editor

yarn

yarn add react-photo-layout-editor

Usage

원하는곳에 컴포넌트를 삽입합니다.
한페이지에 단독으로 사용하는것을 권장합니다.

import PhotoLayoutEditor from 'react-photo-layout-editor';

<PhotoLayoutEditor ref={(r) => { ple = r }}/>

Properties

컴포넌트를 마운트할때 설정값을 정의할 수 있습니다.

Name default Type Description
body {} object 툴바와 그리드를 편집하는 영역. 아래 body 항목을 참고
side {} object 이미지를 관리하는 사이드 팔레트 영역. 아래 side 항목을 참고
uploadScript null string 이미지를 서버로 업로드 처리하는 주소
uploadParamsConvertFunc null function 이미지를 서버로 업로드하고 그 결과값을 받아 side.files에 이미지를 등록할 수 있도록 값을 변경하는 콜백함수
updateStoreFunc null function store 데이터가 변경될때마다 실행하는 콜백함수
callback {} object 여러가지 행동에 대한 콜백 함수들의 모음

body

툴바와 그리드 편집 영역

Name default Type Description
setting {} object 그리드 편집기의 설정값. setting 섹션 참고
blockColor rgba(211,211,211,1) string 블럭 하나의 기본 배경색
grid [] array 블럭 데이터값 목록

body.setting

그리드 편집 영역의 설정값

Name default Type Description
width 100 number 기본 블럭 하나의 가로사이즈
height 100 number 기본 블럭 하나의 세로사이즈
column 5 number 한줄에 들어가는 기본 블럭의 갯수
outerMargin 10 number 그리드 겉부분의 여백값
innerMargin 10 number 블럭 사이의 여백값
bgColor rgba(255,255,255,1) string 그리드 배경색

side

이미지를 관리하는 사이드 팔레트 영역

Name default Type Description
files [] array 이미지 목록
visible true boolean 팔레트 표시유무

callback

컴포넌트 콜백 함수들

Name params Description
init 컴포넌트가 초기화 되었을때 호출합니다.
sideUploadStart 사이드 영역 이미지를 업로드를 시작할때 호출합니다.
sideUploadProgress loaded,total,percent 사이드 영역 이미지를 업로드중일때 호출합니다.
sideUploadComplete res 사이드 영역 이미지 하나를 업로드가 끝나면 호출합니다.
sideUploadCompleteAll 사이드 영역 모든 이미지 업로드를 완료하면 호출합니다.
sideUploadFail 사이드 영역 이미지 업로드를 실패하면 호출합니다.
sideRemove images 사이드 영역 이미지를 삭제할때 호출합니다.

API

PhotoLayoutEditor를 컨트롤할 수 있습니다. 먼저 컴포넌트를 접근할 수 있도록 인스턴스 변수로 만들어줍니다.
다음 컴포넌트와 같이 ref를 이용하여 ple이름의 변수를 이용하여 API를 사용할 수있습니다.

let ple = null;
<PhotoLayoutEditor ref={(r) => { ple = r }}/>

자세한 API의 내용은 다음 링크를 참고하세요.

Development

이 프로그램을 개발하기 위하여 데모 페이지를 띄울 수 있습니다.
다음 과정을 통하여 브라우저에 개발에 사용되었던 데모 페이지를 열어볼 수 있습니다.

  1. git clone https://github.com/redgoose-dev/react-photo-layout-editor.git
  2. cd react-photo-layout-editor
  3. yarn install
  4. yarn run dev
  5. in your browser, connect http://localhost:3000
Comments
  • 안녕하세요. 이미지 만들려고 할때 CORS 에러가 나는데 해결방법 아시나요?

    안녕하세요. 이미지 만들려고 할때 CORS 에러가 나는데 해결방법 아시나요?

    'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.

    aws s3에 있는 이미지 가져와서 make 이미지 할려 해당 CORS 메시지가 나오는데 해결방법 혹시 알수 있을까요?ㅎㅎ 그럼 감사합니다!! 수고하세요!

    help wanted 
    opened by allysung 6
  • Just can't preview pics.

    Just can't preview pics.

    I have installed react-photo-layout-editor, and copied some code from dev folder. After configuring some loaders in webpack and other stuff, now everything works fine except the preview part of pictures.

    layout_problem

    As you can see, pics will be added successfully after I click it. But it just won't show up in the preview part. Could you help me? Thanks a loooot!

    opened by TingAlex 4
  • upgrade project

    upgrade project

    슬슬 좀 다시 다듬어야할때가 온것같다.

    아마 전체적으로 손보면서 상태관리 라이브러리를 redux -> recoil로 변경시키면서 좀 공부해보고싶은데 이정도 되면 아마 재작업하면서 컴포넌트들을 전부 포팅해봐야하지 않을까 느껴진다.

    이걸 작업하면서 요즘 react를 어떻게 작업해야하는지 감좀 잡을 수 있을거라는 기대감도 들고, 요즘 부쩍 이 프로젝트를 다듬어보고 싶어진다.

    일단 할일목록에 추가하기 위하여 이슈로 남겨둔다.

    reformation 
    opened by redgoose-dev 3
  • Learn how to attach text.

    Learn how to attach text.

    This post was write by google translator.

    In the react-photo-layout-editor, the" Text editor "function is out of range.


    There are two ways.

    1. Add a toolbar button similar to "Setting" function from the forked Repository.
    2. Separate the text addition function and layout creation function.

    Plan A

    new mockup 1

    It's a difficult way.

    Fork out react-photo-layout-editor and add text functionality. You need to add your own features.


    new mockup 2

    You can add features without modifying react-photo-layout-editor.
    Press Next step button to go toAdd textfunction.
    You can create Add text function.

    react-photo-layout-editor can be extracted in Canvas format.
    https://github.com/RedgooseDev/react-photo-layout-editor/wiki/API.Util#export

    invalid 
    opened by redgoose-dev 2
  • API 제작

    API 제작

    새 버전에 맞는 API 재작성이 필요함.

    • [x] 기능에 대한 정의 필요함
    • [x] 메서드 목록 작성
    • [x] 기능구현
    • [ ] ~~문서 작성~~

    API 메서드 목록

    Side

    • [x] api.side.add()
    • [x] api.side.remove()
    • [x] api.side.clear()
    • [x] api.side.selection()
    • [x] api.side.select()
    • [x] api.side.toggleSelectAll()
    • [x] api.side.attachToGrid()
    • [x] api.side.getItems()
    • [x] api.side.getImages()
    • [x] api.side.getKeys()
    • [x] api.side.upload()

    Grid

    • [x] api.grid.getKeys()
    • [x] api.grid.getBlocks()
    • [x] api.grid.shuffle()
    • [x] api.grid.assignImages()
    • [x] api.grid.assignImage()
    • [x] api.grid.removeImages()
    • [x] api.grid.update()
    • [x] api.grid.add()
    • [x] api.grid.remove()
    • [x] api.grid.select()
    • [x] api.grid.unselect()
    • [x] api.grid.toggleSelectAll()
    • [x] api.grid.duplicate()
    • [x] api.grid.setPreference()
    • [x] api.grid.getPreference()

    Util

    • [x] api.util.toggleSide()
    • [x] api.util.export()
    • [x] api.util.import()
    • [x] api.util.makeImage()
    reformation 
    opened by redgoose-dev 2
  • 목록 데이터 타입에 대한 고민

    목록 데이터 타입에 대한 고민

    side와 grid쪽의 목록이 Array형식으로 되어있는데 숫자키값을 가지고 있는 Object 형식으로 바꾸는게 더 좋아보인다. 왜냐하면 배열로 된 데이터에서 특정 항목에 대한 탐색을 하는데 코드가 번거롭고 중첩으로 for문을 돌려야 하는 상황이 많이 보여서 좀 불안해보인다.

    만약 변경하게 되면 큰 작업이 될거 같아서 고민해볼 필요가 있음.

    question 
    opened by redgoose-dev 1
  • cropper 리사이즈 및 스크롤 이슈

    cropper 리사이즈 및 스크롤 이슈

    cropper가 열린 상태에서 스크롤을 내리거나 리사이즈를 할 때 위치가 틀어지는 현상이 발생한다. cropper에서 position: fixedabsolute로 변경하면 스크롤은 해결할 수 있겠지만 리사이즈는 쉽게 해결이 불가능하다.

    리사이즈 이벤트는 왠만하면 피하고 싶은데 피하려면 cropper 레이아웃을 변경해야할듯하다.

    bug 
    opened by redgoose-dev 1
Releases(1.2.5)
  • 1.2.5(Nov 24, 2019)

  • 1.2.4(Aug 11, 2019)

    제대로 사용할 수 없는 수준이어서 개발 환경들을 전부 최신버전으로 업그레이드 하면서 정리했습니다.

    리엑트 및 모든 벤더들 업그레이드 및 빌드환경 수정

    빌드 환경을 다시 만들었습니다.
    이전 방식은 쓸수없을정도로 엉망이고, babel같은게 대응이 어려워서 빌드 환경을 다시 만들게 되었습니다.

    componentWillReceiveProps 경고 이슈

    componentWillReceiveProps 관련 메시지는 photo-layout-editor에서는 최대한 고쳤지만 react-grid-layout 부분에서 해결된 상태가 아니기 때문에 고쳐지길 기다릴수밖에 없습니다.

    콜백함수 추가 기능개선

    https://github.com/redgoose-dev/photo-layout-editor/issues/44 이슈에서 이미지를 삭제할때 콜백이 없어서 서버에서 삭제할 수 있는 방법이 없었습니다. 그래서 callback이라는 콜백함수를 모은 props를 만들어서 이미지 업로드나 삭제할때의 콜백함수를 호출 할 수 있도록 고쳤습니다.

    Source code(tar.gz)
    Source code(zip)
  • 1.1.7(Aug 31, 2017)

    v1.1.6

    • react 16.0.0으로 업데이트
    • 다른 디펜더시들을 최신버전으로 업데이트

    v1.1.7

    • 디펜더시 react버전과의 충돌이 발생하여 버전을 15.6.1로 내림.
    • updateStoreFunc props 추가
    Source code(tar.gz)
    Source code(zip)
React-layout - Layout component for React. Handling the overall layout of a page

Layout Handling the overall layout of a page. ⚠️ Note: Implemented with flex lay

uiw 2 Jul 10, 2022
React-Grid-Layout is a grid layout system much like Packery or Gridster, for React.

A draggable and resizable grid layout with responsive breakpoints, for React.

RGL 16.9k Jan 2, 2023
Layout-reactJS - Layout with React JS using NASA API

Layout with React JS using NASA API Website link on the web: Click Here Preview:

Anastacio Menezes 4 Feb 2, 2022
React-masonry - An easy to use and simple masonry layout for React Js based on flexbox column

React Masonry An easy to use and simple masonry layout for React Js based on fle

null 16 Dec 23, 2022
Auto Responsive Layout Library For React

autoresponsive-react Auto responsive grid layout library for React. Who are using ⭐ ⭐ ⭐ alibaba/ice ⭐ ⭐ ⭐ ice-lab/react-materials ⭐ ⭐ ⭐ ant-design/ant

达峰的夏天 1.5k Dec 15, 2022
The layout engine for React

Responsive, sortable, filterable and draggable grid layouts with React Design Principles ????‍?? Muuri-React is the React implementation of the amazin

Paolo Longo 274 Dec 21, 2022
A draggable and resizable grid layout with responsive breakpoints, for React.

React-Grid-Layout React-Grid-Layout is a grid layout system much like Packery or Gridster, for React. Unlike those systems, it is responsive and suppo

Samuel Reed 16.9k Jan 1, 2023
Resizable Flex layout container components for advanced React web applications

About Re-F|ex Re-F|ex is a React flex-based layout component library which I created because none of the components I found out there could satisfy my

Philippe Leefsma 532 Jan 8, 2023
Animated grid layout component for React

react-stonecutter Animated grid layout component for React, inspired by Masonry. Choose between CSS Transitions or React-Motion for animation. Demo In

Dan Train 1.2k Dec 24, 2022
FlexLayout is a layout manager that arranges React components in multiple tab sets, tabs can be resized and moved.

FlexLayout is a layout manager that arranges React components in multiple tab sets, tabs can be resized and moved.

Caplin 649 Jan 7, 2023
Resizable Flex layout container components for advanced React web applications

About Re-F|ex Re-F|ex is a React flex-based layout component library which I created because none of the components I found out there could satisfy my

Philippe Leefsma 530 Dec 21, 2022
This react component resize the layout of HTML using a handle

react-resize-layout This react component resize the layout of HTML using a handle Demo View the demo page Example View the example demo page npm insta

null 36 Nov 3, 2022
XMasonry: Masonry Layout for React JS

Responsive, minimalistic and full-featured native masonry layout (grid) for React JS.

Nikita Savchenko 79 Dec 2, 2022
Physical representation of layout composition to create declarative responsive layouts in React.

Atomic Layout is a spatial distribution library for React. It uses CSS Grid to define layout areas and render them as React components. This pattern e

Artem Zakharchenko 1.1k Dec 26, 2022
A powerful React component to abstract over flexbox and create any layout on any browser

FlexView A powerful React component to abstract over flexbox and create any layout on any browser. Install yarn add react-flexview Why The flexbox AP

buildo 277 Nov 11, 2022
Kilvin is a set of universal & primitive Layout Components for React.

Kilvin is a set of universal & primitive Layout Components for React.

Robin Weser 21 May 26, 2022
Simple Layout Field to offer a variety possibilities to react-jsonschema-forms

react-jsonschema-form-layout Just a small custom field for the awesome react-jsonschema-form. see DEMO Key features: support bootstrap's grid add non-

Audibene Labs 67 Jun 16, 2022
🦸 Motion Layout - Create beautiful immersive React hero animations using shared components.

Motion Layout Create beautiful immersive React hero animations using shared components. Docs React Motion Layout Docs About Motivation There are amazi

Jefferson Licet 584 Dec 25, 2022
🤸 Configurable grid and layout engine for React

gymnast is a configurable grid for React With gymnast, you can eliminate your layout css or reduce it to just a few lines. Learn how to use gymnast in

gymnast.js 38 May 7, 2022