I have some code that I added to Invision Power Board 1.3.1 to resize the display of images posted, and I was wondering if it could be used in 4Images 1.7? Here's the resize code:
$maxwidth=580;
Maximum image width setting of 580 Pixels.
$imagesize = getimagesize ($url);
The instruction to get the actual image size of an image from the address in the [img] tag posted by the user.
$newwidth=$imagesize[0];
The original image image width.
$newheight=$imagesize[1];
The original image image height.
if($imagesize[0] > $maxwidth) {
$newwidth=$maxwidth;
$newheight=($maxwidth/$imagesize[0])*$imagesize[1];
}
The array to calculate the new image size based on IF the original image's width is greater than the maximum image width setting, and if it is, THEN the new image width is the maxwidth setting (580), and the new image height is the maxwidth divided by the original image width, then multiplied by the original image height. Or for an 800x600 image that would be (580/800 = .725)*600 = 435 so therefore the new image size is 580x435.
return "<img src='$url' border='0' width='$newwidth' height='$newheight' alt='user posted image'>";
The new image source statement returned to the program to display the image in the new dimensions.
What I would like to do is be able to upload my photos in their original size of 2048x1536, yet have the Gallery display them in 550x412.
Do you think that is possible?
(Bear in mind, this does not resize the actual image, just how it is displayed. The original image would still be however big it was, and the file size would not change. Also, even though this was written for IPB, it is pretty much standard PHP as far as I know.)