Re: [PHP] KEEP IMAGE RATIO
Ok, before you go responding with percentages, I should note this. consider this: Image1 : 100x100 (Ratio = 1:1) Image2 : 100x200 (Ratio = 1:2) Space available for display : 75x75 now, i can say width=75% height=75%, but this will only work for Image1, since Image2 will end up as 75x150 (which clearly does not fit the 75x75 constraints) now, if i specify width=75 height=75, again, this works for Image1, but not Image2, since the new Image2 ratio will be 1:1, with Image2 losing 1/2 of it's heigth ratio. John Manko wrote: Ok, I'm surprised that this is not taken care of with HTML. I propose the following standard (but also looking for a PHP workaround if available) for the Img HTML tag: RATIO = Keep|Ignore, default Ignore lt; img width='x' height='y' RATIO='Keep|Ignore' gt; Where, RATIO=Keep will inlarge the image to a max WIDTH or HEIGHT (which ever comes first), without changing the perspective ratio. I don't want to have to use Photoshop or Gimp to ensure that the images a width=x or heigth=y will keep ratio. If anyone belongs to W3C, please consider this. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] KEEP IMAGE RATIO
Leave out the height or width tag and it will keep the ratio by itself won't it? -Original Message- From: John Manko [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2003 9:46 AM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] KEEP IMAGE RATIO Ok, before you go responding with percentages, I should note this. consider this: Image1 : 100x100 (Ratio = 1:1) Image2 : 100x200 (Ratio = 1:2) Space available for display : 75x75 now, i can say width=75% height=75%, but this will only work for Image1, since Image2 will end up as 75x150 (which clearly does not fit the 75x75 constraints) now, if i specify width=75 height=75, again, this works for Image1, but not Image2, since the new Image2 ratio will be 1:1, with Image2 losing 1/2 of it's heigth ratio. John Manko wrote: Ok, I'm surprised that this is not taken care of with HTML. I propose the following standard (but also looking for a PHP workaround if available) for the Img HTML tag: RATIO = Keep|Ignore, default Ignore lt; img width='x' height='y' RATIO='Keep|Ignore' gt; Where, RATIO=Keep will inlarge the image to a max WIDTH or HEIGHT (which ever comes first), without changing the perspective ratio. I don't want to have to use Photoshop or Gimp to ensure that the images a width=x or heigth=y will keep ratio. If anyone belongs to W3C, please consider this. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] KEEP IMAGE RATIO
but that won't address the space limit for display for image larger than 75x75 Brian S. Drexler wrote: Leave out the height or width tag and it will keep the ratio by itself won't it? -Original Message- From: John Manko [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2003 9:46 AM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] KEEP IMAGE RATIO Ok, before you go responding with percentages, I should note this. consider this: Image1 : 100x100 (Ratio = 1:1) Image2 : 100x200 (Ratio = 1:2) Space available for display : 75x75 now, i can say width=75% height=75%, but this will only work for Image1, since Image2 will end up as 75x150 (which clearly does not fit the 75x75 constraints) now, if i specify width=75 height=75, again, this works for Image1, but not Image2, since the new Image2 ratio will be 1:1, with Image2 losing 1/2 of it's heigth ratio. John Manko wrote: Ok, I'm surprised that this is not taken care of with HTML. I propose the following standard (but also looking for a PHP workaround if available) for the Img HTML tag: RATIO = Keep|Ignore, default Ignore lt; img width='x' height='y' RATIO='Keep|Ignore' gt; Where, RATIO=Keep will inlarge the image to a max WIDTH or HEIGHT (which ever comes first), without changing the perspective ratio. I don't want to have to use Photoshop or Gimp to ensure that the images a width=x or heigth=y will keep ratio. If anyone belongs to W3C, please consider this. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] KEEP IMAGE RATIO
ok, i see what you mean.. John Manko wrote: but that won't address the space limit for display for image larger than 75x75 Brian S. Drexler wrote: Leave out the height or width tag and it will keep the ratio by itself won't it? -Original Message- From: John Manko [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2003 9:46 AM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] KEEP IMAGE RATIO Ok, before you go responding with percentages, I should note this. consider this: Image1 : 100x100 (Ratio = 1:1) Image2 : 100x200 (Ratio = 1:2) Space available for display : 75x75 now, i can say width=75% height=75%, but this will only work for Image1, since Image2 will end up as 75x150 (which clearly does not fit the 75x75 constraints) now, if i specify width=75 height=75, again, this works for Image1, but not Image2, since the new Image2 ratio will be 1:1, with Image2 losing 1/2 of it's heigth ratio. John Manko wrote: Ok, I'm surprised that this is not taken care of with HTML. I propose the following standard (but also looking for a PHP workaround if available) for the Img HTML tag: RATIO = Keep|Ignore, default Ignore lt; img width='x' height='y' RATIO='Keep|Ignore' gt; Where, RATIO=Keep will inlarge the image to a max WIDTH or HEIGHT (which ever comes first), without changing the perspective ratio. I don't want to have to use Photoshop or Gimp to ensure that the images a width=x or heigth=y will keep ratio. If anyone belongs to W3C, please consider this. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] KEEP IMAGE RATIO
Ok, before you go responding with percentages, I should note this. consider this: Image1 : 100x100 (Ratio = 1:1) Image2 : 100x200 (Ratio = 1:2) Space available for display : 75x75 now, i can say width=75% height=75%, but this will only work for Image1, since Image2 will end up as 75x150 (which clearly does not fit the 75x75 constraints) now, if i specify width=75 height=75, again, this works for Image1, but not Image2, since the new Image2 ratio will be 1:1, with Image2 losing 1/2 of it's heigth ratio. HTML isn't smart enough to figure that out and this is a PHP list, anyhow. Use the image functions to get the height and width of the image. Find out which is larger and determine what percent you need to scale that number down to get to 75 pixels. Now scale the other dimension by the same percentage. Plug both into the img tag and be done with this! ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] KEEP IMAGE RATIO
You will note that I did say that I was looking for a PHP solution to this, anyhow. HTML isn't smart enough to figure that out and this is a PHP list, anyhow. Thank you for the info. I still think that HTML should handle it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] KEEP IMAGE RATIO
um.. sorry for the off topic discussion.. John Manko [EMAIL PROTECTED] wrote: You will note that I did say that I was looking for a PHP solution to this, anyhow. HTML isn't smart enough to figure that out and this is a PHP list, anyhow. Thank you for the info. I still think that HTML should handle it. There is no way that html can handle the situation. If you have an image that is 100x200 and you want to fit it into a 75x75 square that has the correct ratio, you are going to need to have some sort of border on the top and/or bottom of the image. Now if we leave it to the browser to handle this there are so many different options to do when scaling down the image that it becomes impossible to predict what will be displayed. I say your alternate solution would be to write a image generating php script that scales your image down to 75x75 yourself and reference that image. Good luck. Curt. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] KEEP IMAGE RATIO
On Wednesday 16 July 2003 09:46 am, John Manko wrote: Ok, before you go responding with percentages, I should note this. consider this: Image1 : 100x100 (Ratio = 1:1) Image2 : 100x200 (Ratio = 1:2) Space available for display : 75x75 now, i can say width=75% height=75%, but this will only work for Image1, since Image2 will end up as 75x150 (which clearly does not fit the 75x75 constraints) now, if i specify width=75 height=75, again, this works for Image1, but not Image2, since the new Image2 ratio will be 1:1, with Image2 losing 1/2 of it's heigth ratio. And I still don't see how your proposed method handles the problem you mentioned above with Image2... RDB John Manko wrote: Ok, I'm surprised that this is not taken care of with HTML. I propose the following standard (but also looking for a PHP workaround if available) for the Img HTML tag: RATIO = Keep|Ignore, default Ignore lt; img width='x' height='y' RATIO='Keep|Ignore' gt; Where, RATIO=Keep will inlarge the image to a max WIDTH or HEIGHT (which ever comes first), without changing the perspective ratio. I don't want to have to use Photoshop or Gimp to ensure that the images a width=x or heigth=y will keep ratio. If anyone belongs to W3C, please consider this. Thanks -- - /\ ASCII Ribbon Campaign against HTML \ / email and proprietary format X attachments. / \ - Have you been used by Microsoft today? Choose your life. Choose freedom. Choose LINUX. - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] KEEP IMAGE RATIO
And I still don't see how your proposed method handles the problem you mentioned above with Image2... RDB Now, first, what would you prefer? Second, I hope you understand how the new feature would address the issue (and that you know what the issue is - if i explained it clearly, of course) As sent to [EMAIL PROTECTED] (please read in total, some stuff added) -- consider: Image1 : 100x100 (Ratio = 1:1) Image2 : 100x200 (Ratio = 1:2) Space available for display : 75x75 now, i can say width=75% height=75%, but this will only work for Image1, since Image2 will end up as 75x150 (which clearly does not fit the 75x75 constraints) now, if i specify width=75 height=75, again, this works for Image1, but not Image2, since the new Image2 ratio will be 1:1, with Image2 losing 1/2 of it's heigth ratio. Rather, with img width=75 height=75 ratio=keep, we will have the following results: Final Display: Image1 : 75x75 : (RATIO 1x1) Image2 : 38x75 (37.5x75) : (RATIO 1:2) This is something simple enough for the browser to handle, and I think it should. - Now, as far as not seeing how this helps, keep in mind that this is NOT a feature, but SHOULD, and a reponse I got from [EMAIL PROTECTED] is the following: = this is what I use to maintain aspect ratio and constrain the image to the limits I have if($image_path == ) { $relative_directory = /images/logo.gif; $size = @GetImageSize(getenv(DOCUMENT_ROOT).$relative_directory); } else { $relative_directory = /images/gallery/$sportid/; $size = @GetImageSize(getenv(DOCUMENT_ROOT).$relative_directory./.$image_path); } $width = $size[0]; $height = $size[1]; if($width 500) { if(($width 500)($height 400)) { $width2 = ($size[0] - ( $size[0] * (1 - (500/$size[0]; $height2 = ($size[1] - ( $size[1] * (1 - (400/$size[1]; } else { $width2 = ($size[0] - ( $size[0] * (1 - (500/$size[0]; $height2 = $size[1]; } } else { $width2 = $size[0]; $height2 = $size[1]; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php