Author Topic: Image Display Resize  (Read 7802 times)

0 Members and 1 Guest are viewing this topic.

Offline Ax Slinger

  • Newbie
  • *
  • Posts: 25
    • View Profile
Image Display Resize
« on: November 25, 2005, 10:08:06 AM »
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:

Quote
$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.)

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: Image Display Resize
« Reply #1 on: November 25, 2005, 10:22:08 AM »
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline Ax Slinger

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Image Display Resize
« Reply #2 on: November 25, 2005, 11:33:22 AM »
Thanks for the quick reply. But I can't read that... I have enough trouble with English. :D

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: Image Display Resize
« Reply #3 on: November 25, 2005, 11:56:23 AM »
Thanks for the quick reply. But I can't read that... I have enough trouble with English. :D

Whats your language????

here a little translate that can help you.

finde = find / search for
danach einfügen = insert after
suche = find /search for
ersetze durch = replace with
öffne = open
davor = above

Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline Ax Slinger

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Image Display Resize
« Reply #4 on: November 25, 2005, 12:34:11 PM »
Ok, thanks. I'll give it a try when I am a little more awake. It's 4:00 am here at the moment.

By the way, I do speak English... That was a joke.  :wink:

Somewhere I have a text file with some German to English translations in it. The question is, where did I put it?

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: Image Display Resize
« Reply #5 on: November 26, 2005, 12:27:28 PM »
Quote
Somewhere I have a text file with some German to English translations in it. The question is, where did I put it?

a german translation for this mod? i don´t now what you mean.
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline Ax Slinger

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Image Display Resize
« Reply #6 on: November 30, 2005, 12:15:25 AM »
No, not for this mod... Just in general. It started with a F1 Racing game a friend of mine in Germany sent me, and all the text was in German. He sent me a text file with several words translated that were in the game, and I added a bunch more to it. Maybe about 200 words al together. But now I can't find it. It's probably on one of my 100's of CDR backup CD's somewhere...

Offline Ax Slinger

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Image Display Resize
« Reply #7 on: November 30, 2005, 05:12:19 AM »
Ok... It took some doing to translate, but I found a good German to English dictionary and went for it. And after several errors, I finally got it working. I had to change some things around a bit because of another mod I had installed, but it works, so I am a happy camper... 

Thanks a lot for the help! :mrgreen: