oceans Posted June 1, 2007 Share Posted June 1, 2007 Dear Friends, I src a jpg file, I noted it gets distored, there are not many paramerters to play. So I conclude, if the image width and height does not equal to src width and height, the image will be bad. Am I right? If so how can i get arround, because it is sick to walk at pixel level. :'( Quote Link to comment https://forums.phpfreaks.com/topic/53830-solved-disrorted-image/ Share on other sites More sharing options...
AndyB Posted June 1, 2007 Share Posted June 1, 2007 If you distort an image (by setting width or height to incorrect values or an incorrect ratio) then yes it gets distorted. What else would you expect??? That's it. There's no way around it. Quite what 'walk at the pixel level' means beats me. I wonder if getimagesize() has anything to do with a solution - if that's what you need. Quote Link to comment https://forums.phpfreaks.com/topic/53830-solved-disrorted-image/#findComment-266153 Share on other sites More sharing options...
oceans Posted June 1, 2007 Author Share Posted June 1, 2007 ha ha ha ha, you are funny, really I am laughing , I was typing fast earlier, also had a bit more serious thing in my mind while typing this issue. Later I noted, if the proportion ratio is maintained thing are slightly ok, but i am doing an image upload from clients, they have all sort of sizes, yes i can mention i only accept this size, ya by the way can i get the width and height of an image, that way i can force the client to crop to my size, may be your getimagesize() will help me Quote Link to comment https://forums.phpfreaks.com/topic/53830-solved-disrorted-image/#findComment-266233 Share on other sites More sharing options...
Dragen Posted June 1, 2007 Share Posted June 1, 2007 getimagesize() wil give you the width and height of any image. You could use it in whatever upload form you have for clients to check that the image is a ertain size.. or you could use it wherever you display the image and set the images width and height to whatever it actually is, instead of having to guess Quote Link to comment https://forums.phpfreaks.com/topic/53830-solved-disrorted-image/#findComment-266238 Share on other sites More sharing options...
oceans Posted June 1, 2007 Author Share Posted June 1, 2007 Dear Dragen, I tried it is not giving me a value, I use this to validate a potential upload file size $_FILES["file"]["size"], I want to validate width & height how can I, I tried getimagesize(["file"]), it is not working, I am unsure how can a function retuen 2 values? error I got " Warning: getimagesize(Array) [function.getimagesize]: failed to open stream: No such file or directory " Quote Link to comment https://forums.phpfreaks.com/topic/53830-solved-disrorted-image/#findComment-266338 Share on other sites More sharing options...
Dragen Posted June 1, 2007 Share Posted June 1, 2007 use it like this: $image = 'http://www.mydomain.com/myimage.gif' list($width, $height) = getimagesize($image) echo '<img src="' . $image . '" width="' . $width . '" height="' . $height . '" border="0" alt="" /> Quote Link to comment https://forums.phpfreaks.com/topic/53830-solved-disrorted-image/#findComment-266381 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.