I am trying to get width and height of image by doing something like this.
$width = imagesx("abc.jpg");
$height = imagesy("abc.jpg");
Even when I only have this two lines in the file with no linkage to any other files, I still got this error. The image is in server and I have no idea what is wrong. Anyone can help, please? Thank you.
Warning: imagesx(): supplied argument is not a valid Image resource in ..
Warning: imagesy(): supplied argument is not a valid Image resource in ..
You need to create an image resource, as
imagesy()expect it as first parameter. That can be created withimagecreatefromjpeg()from your filename:Alternatively if you only need to get image width an height, you can make use of the
getimagesizefunction:It accepts the filename right ahead and does not require to create a gd image resource.