-1

I am trying to resize and crop an image on a php page. I either want to use gd lib or jcrop with FileReader(). Which would be a better wat to go. what are the pros/cons ?

Skeletor
  • 3,201
  • 4
  • 30
  • 51
  • 1
    Try them both and then you tell us what the pros and cons are! :D – Rasclatt May 08 '15 at 06:18
  • I have already used them both but for knowing the pros and cons i have to use them in a long run. I asked this question to get advices from users that are already familar (prof) to this. in fact more than %50 questions here in stackoverflow could have the same answer as yours. but most of them have more satisfying aswers. anyway thank your useful advice @Rasclatt :) . – Skeletor May 08 '15 at 06:40
  • Well SO is for code conundrums, and since there is no issue here and any answer you get will be opinion-based, the question is considered off-topic. There may be other forums in the StackExchange (maybe?) that would be better served with your question. I have not looked through them all. – Rasclatt May 08 '15 at 06:46

1 Answers1

1

jcrop and FileReader() both are the frontend browser library or api,while gb lib is the php backend library.

I have to two solutions FYI.

  1. jcrop+FileReader() for user crop the image,and then frontend get new the cropped image's data like {x:50,y:100,width:100,height:200} relative to original image,which will be posted to backend for php process gb lib( imagecrop function).

pros: balance both frontend and backend performance. cons: code looks more complicated

  1. only jcrop+FileReader() for user crop the image,and them frontend get new the cropped image's base64 string,then post to the server.Server no need to call gb lib to crop.Just decode base64 image and save it as file.

pros: code looks more simple. cons: increase frontend pressure. Save bandwidth (no need to upload original image)

Finally,up to you to add more logic in frontend or backend.

Adam Liu
  • 41
  • 3