I'm searching through PHP's GD functions, and, unless I'm totally blind, I can't find a function that will calculate the size of a GD image in memory; only getimagesize(), which only works with images on disk.
I have some images that are imagerotate()'d by arbitrary amounts, and this causes them to be resized. I'd like to know how wide those images are after they are rotated. I suppose I could write some function that figures it out based on the degree of rotation, but since I suck at such math, I'd rather not. Writing the image to disk and then using getimagesize() would be even worse... Is there a simpler way to just get the width of an image resource?
TIA.
GD - Getting width/height of image in memory?
Moderator: General Moderators
Try this
Code: Select all
<?php
$width = imagesx($image);
$height = imagesy($image);
?>