Intervention / image

PHP Image Processing
https://image.intervention.io
MIT License
13.87k stars 1.5k forks source link

Image Uploads with 1px Black Border on Top #168

Closed Cleanse closed 10 years ago

Cleanse commented 10 years ago

Has anyone else come across this issue? Some (most) image files are uploaded with a black border 1px high on top of the image.

Cleanse commented 10 years ago

The border color is actually #000200 / rgb 0,2,0,1

olivervogel commented 10 years ago

Please provide more Information. Does It only Happen with uploaded images? Do you use Gd or Imagick? Can you provide System information and Code examples?

Cleanse commented 10 years ago

Hi, sorry for the late reply. I use GD.

GD Support enabled GD Version 2.0.36 FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.4.8 GIF Read Support enabled GIF Create Support enabled JPEG Support enabled libJPEG Version unknown PNG Support enabled libPNG Version 1.2.46 WBMP Support enabled

Original: http://imgur.com/LX9p9sH Cropped: http://imgur.com/xpVBtzE Final Output: http://imgur.com/jIm8uO0 (note the black bar up top)

The code:

if(Input::hasFile('simg')) {

    $imgput = Input::all();
    $fileName = trim(time() . '-' . $imgput['simg']->getClientOriginalName());
    $path   = public_path().'/images/';

    $image  = Image::make($imgput['simg']->getRealPath());

    $image->resize(450, null, true)
          ->crop(450,250)
          ->save($path . $fileName);

}
olivervogel commented 10 years ago

Sorry, I can't reproduce this error with GD 2.1.

Have you tried using grab() instead of resize/crop?

I see you're using Intervention/Image 1.* code. Maybe try upgrading to 2.* and see if this works.

Cleanse commented 10 years ago

Updated to the 2.* version today and first image I uploaded had the black border up top >.>. Wondering if the javascript I am using the grab the crop area could be a cause?

olivervogel commented 10 years ago

It's possible. Have you already checked? Would be interesting to know, if this is an outside issue.

Cleanse commented 10 years ago

Ill do some tests after I update jcrop tonight.