Solvedimage Empty content

Hey there, I am using your package along with the new version of Laravel (5.2) and I am getting and empty content (blank image) using the example that you got posted on your web site.


// create a new image resource
$img = Image::canvas(800, 600, '#ff0000');

// send HTTP header and output image data
header('Content-Type: image/png');
echo $img->encode('png');

I do not know why it happens because I have the same controller doing the duty with the before Laravel version and it works fine.

any guide will be great.


23 Answers

✔️Accepted Answer

@angelov be sure to check for any whitespace outside any <?php tag. That was the issue for me.

In a app/config.php-file, I had a tab character before the PHP tag started, and that caused the empty square, because it conflicted with the image data.

A way to test this, could be to make a route that returns nothing, and then inspect the source to check if the output is actually empty as expected. If not, good luck finding that space/tab/whatever.

Related Issues:

image Empty content
@angelov be sure to check for any whitespace outside any <?php tag That was the issue for me In a ap...
Pillow ImportError: cannot import name 'PILLOW_VERSION' from 'PIL' (unknown location)
I'm getting the same error right now after conda install pillow on Win 10 It installed pillow 6.2.1 ...
Pillow zlib requirement on Alpine Linux
@wiredfool Thanks I was having the same problem building a docker image hey ...
react native image crop picker Build failed, no such file libReact.a
@chrise86 got the error again and this fixed it properly Go to your build phases and remove libReact...
Pillow cannot write mode RGBA as JPEG (4.2.0)
@AymericHENRY Hi While this is just reiterating what has already been said you should have no proble...
sharp fatal error: 'vips/vips8' file not found
It looks like commit isaacs/minipass@40e1d61 might have collided with mafintosh/end-of-stream#11 and...
ImageMagick Memory issues
For anyone who is still facing this problem even after increasing the memory limit try commenting ou...
Pillow Can't install Pillow on Android
It does the trick: $ pkg install python libjpeg-turbo libcrypt ndk-sysroot clang zlib $ LDFLAGS=-L${...
react native image crop picker unexpected element <queries> found in <manifest>
upgrade your gradle version to be able to recognize new queries element Version Tell us which versio...
sharp Can't compile under Apple Silicon M1 arm64
🎉 I'm happy to report that thanks to the huge effort of the homebrew team and specially @fxcoudert ...
react native image crop picker Build failing after installing react-native-image-crop-picker
@PavanTank4631 The solution is there in the same stackoverflow link that you have provided: No need ...
sharp Package libffi was not found in the pkg-config search path
Coincidentally I just ran into this same error on an OS X machine: and was able to fix it by followi...
react native fast image Unable to compile: Duplicate interface definition for class 'FLAnimatedImageView'
Product-> Clean and then rm -rf ~/Library/Developer/Xcode/DerivedData/* did the trick for me. ...
uCrop FileUtils NumberFormatException
This is not a complete solution just nothing will happen But I think users should be able to open fi...
next optimized images Plugin crashing docker build with node-alpine image
I've only used the node:8.11 docker image with this plugin before but I tried to run my project on n...
Pillow Unable to install on macOS Big Sur (zlib missing)
Run export SYSTEM_VERSION_COMPAT=1 before all other scripts They say Big Sur is both 10.16 and 11.0 ...
react native image crop picker Failed to resolve: com.github.yalantis:ucrop:2.2.2-native
what i was doing wrong is putting both of these in buildscript instead of allprojects ...
react native fast image IOS invariant violation: requireNativeComponent FastImageView was not found in the UI manager
Make sure you run pod install and re-build your entire project. how can I fix this error?????? ...
react native image crop picker openCropper, error [permission denied]
Hi the error happens in Android Q regardless of storage permission Version Tell us which versions yo...
flutter_cached_network_image using placeholder on CachedNetworkImageProvider or directly use CachedNetworkImage
@MahdiPishguy sorry for my late reaction ImageProviders can only return 1 image so this cannot retur...
react native fast image 'React/RCTResizeMode.h' file not found
I had the same problem The link doesn't really work so you need to do the manual install I did the c...
sharp Failure building node-gyp: 403 downloading binaries from bintray
In case we lose Bintray again Hi I'm getting an error installing sharp in our CI environment: Rest o...
Pillow The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source
I figured it was my pip version that was behind I close the issue as upgrade the pip version fixed i...
FFImageLoading Change the color of an SVG?
I change color of a SVG from XAML like this <ffsvg:SvgCachedImage WidthRequest=40 HeightRequest=40 H...
Pillow Unable to install Pillow on the Macbook Pro 13 M1 Silicon
If it helps anyone on Apple Silicon brew install libjpeg pip install Pillow works ! ...
react native fast image Execution failed for task ':react-native-fast-image:compileDebugJavaWithJavac'.
I was able to work around this error by following this guide to disable the glide module ...
flutter_cached_network_image Library is incompatible with latest Flutter master
I published a quick fix for this as 2.0.0-rc Wil remove the -rc tag when this flutter version reache...
react native image crop picker RSKImageCropper Redefinition of module cause by bug in Xcode 8.3
@booboothefool under your project go to node_modules/react-native-image-crop-picker/ios/RSKImageCrop...
react native fast image Android build failed.( ios ok) compileReleaseJavaWithJavac FAILED
when i edit node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastI...
sharp Fail in VS2017 : TRK0005: Failed to locate: "CL.exe"
It looks like you're using node-gyp v3.6.0 which added VS2017 support so that's a good start ...
react native image crop picker Multiple language support
@springwq if just change language follow system, in iOS,edit info.plist like: <key>CFBundleLocalizat...
react native fast image Crash: NullPointerException on App Startup
@DylanVann @rtroncoso The issue still persists even after upgrading to 8.1.5 version on Nexus 5x dev...
react native image crop picker v0.33.3 [!] [Xcodeproj] Generated duplicate UUIDs
The issue is back with Pod version 1.10.1 again. Version Tell us which versions you are using: react...
Pillow OSError: cannot identify image file png
image has extra 15 bytes in the beginning and it seems to be truncated Works that way: ...
react native image crop picker Simulator freezes after selecting and posting image - react native 0.63.1
I just update react-native from 0.63.2 to 0.63.3 it fixed the issue for me 😉 Version Tell us which ...
react native fast image WebP with 6.0.0
Import in AppDelegate.m: An add: React Native version: v0.59.8 React version: 16.8.6 React Native Fa...
react native image crop picker To use CocoaPod,Then Archive My App It tell me: 'RSKImageCropper/RSKImageCropper.h' file not found
I think this should be reopened I seem to be facing the same issue (and so are others from the looks...
react native image crop picker Upload to server
For anyone who is using Relay and struggling this is what I did: The important thing is to pass an o...
Pillow Is it possible to use colored Whatsapp/Facebook emoji?
Pillow 8.0.0 has now been released adding support for CBDT and COLR fonts FreeType (and hence also P...
dom to image Doesn't working with Google Fonts
Example of workaround for Google fonts: Get your font import URL: Visit that URL (
gallery dl Instagram stopped working
Should be fixed with 447488f Querying /p/<shortcode>/__a=1 for each post is what gets one blocked/ba...
dom to image Specify output image dimensions
Hi tsayen It would be extremely useful to be able to optionally specify the dimensions for the outpu...
react native image crop picker Not working with react-native v0.60.0
You can temporary do a workaround by changing s.dependency 'React/Core' to s.dependency 'React-Core'...
react native image crop picker RSKimageCropper issue
@NewBen001 yes but with the bad solution Version Tell us which versions you are using: react-native-...
FFImageLoading [Android] Broken Image with AspectFill
For those who can't waiting for the official update base on @velocitysystems solution you can add th...
sharp Linux Error installing sharp
Strange thing is that the user I tried the install has is not the root user but it has sudo privileg...
sharp sharp still requires brew for OS X / macOS Sierra
This issue cropped up for me after updating to macOS Mojave I had been using sharp without issues pr...
Pillow filenames with utf-8 chars not ASCII, preventing port from OpenCV
Excellent blog Thank you nulano for pointing out Victor's blog Key takeaways legacy is messy and a a...
next optimized images scss styles background image parse error
Hi @xeniajensen This is a slightly different issue and has to do with the dynamic require When using...
Magick.NET .Net Core Support
@dlemstra hey ImageMagick is already cross platform will it be possible you to create NuGet package ...