SitePoint Sponsor

User Tag List

Results 1 to 25 of 25
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is PHP capable of determining the width and height of a jpg picture?

    Hi,

    Are there any PHP functions that can return the width and height value of the jpg picture? Is their any way to determine those picture size values?

    -- McSpike --

  2. #2
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    More specifically

    www.php.net/getimagesize

    void GetImageSize(str ImageName);

    returns and array containing the height, width and a combination of both in the form

    $dimen = GetImageSize($image);
    $dimen[0] //Holds width
    $dimen[1] //Holds height
    $dimen[2] //Holds 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF
    $dimen[3] //Holds a string in the form "height=xxx width=xxx"
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks!!

    freddydoesphp,

    Thank you very much! You helped me a lot! )

    -- McSpike --

  5. #5
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They really can learn to use php.net by themselves.

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes of course they can, I just prefer to provide a little more than just a link to the manual, after all thats why they came to this site in the first place.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  7. #7
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    freddydoesphp, exactly!

    Just because I have 3 posts that doesn't mean I heaven't heard of php.net.

    It's a very big php library and It's easier to ask politely here because someone could know something about this and could have experience with exact problem, so that's why I prefer forums and that's why they exist.

    People exchange ideas and help eachother. If php.net is all one can suggest then we wouldn't need this forums, woudln't we? Exactly what freddydoesphp said.

    I've heard nothing but GOOD words about SitePoint and I believe that would NOT be the case if the only thing we could find on this site would be a link to php.net.

    -- McSpike --

  8. #8
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well put, I hope this post won't deter you from posting here in the future McSpike. Your questions are always welcome and I will always do my best to provide you with the most thorough asnwer I can. And I think I speak for most of the regulars around here. So welcome on behalf of me and sitepoint forums.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  9. #9
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SitePoint is the way to go said my friends and they weren't wrong! :)

    freddydoesphp,

    A friend told me you are a No. 1 class dude over here and it shows!

    Just keep up the good work - SP is already in my favorites!

    -- McSpike --

  10. #10
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't agree that the purpose of this forum is for people to ask for the names of PHP functions. If that's all you need, there is a very efficient knowledge base out there called php.net that will do this for you much faster than this forum can.

    Searching for something on a network should be the first attempt at solving a problem, not asking for help. PHP.net provides a very nice tutorial, as well as excellent site-wide search functionality.

    If you're going to search through php.net for the people who are too lazy to do so themselves. The purpose of sitepoint should be to answer problems you have, AFTER you have tried to come up with some information by yourself.

    Take some initiative.

  11. #11
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well if everyone had your attitude then there would be no sitepoint forums, would there? Just try being nice once in a while, not saying that your not because I have seen you post some great posts. But if someone, for whatever reason, comes here and asks a question there are a lot better ways to suggest them using php.net, than saying

    You could have given him a link to the page in the manual, or you could have given him the answer and politely let him know that it is in the manual. But all I am trying to say is we are trying to make people feel welcome not to make them feel intimidated or unwelcome. See my point?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  12. #12
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There would still be sitepoint forums if my attitude were adopted by everyone, because my attitude is merely that the manual should be the first step in obtaining information about PHP functions. The large majority of questions on these forums are not about the names of PHP functions, but rather about implimentation or more complex usage.

    "You could have given him a link to the page in the manual"

    Sorry, but I'm an optimist. I have faith that if I give him a link to php.net he will be able to navigate to the manual, select the correct language, and scroll down to the image functions.


    I was intentionally not nice and polite enough to give him the exact url, because I belive that he is intelligent enough to find it himself, if he is motivated to do so. By finding the page and copying the relevant parts for him, we encourage helplessness.

  13. #13
    Victory shall be mine tubedogg's Avatar
    Join Date
    Mar 2001
    Location
    Medina, OH
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dragging this back on topic, just FYI: RedHat7 appears to break getimagesize(), so if you are distributing a script with this in it, you might want to keep this in mind.
    Kevin

  14. #14
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just for interest, later versions of PHP creates the image code to XHTML standand, so for $size[3], instead of:

    height=100 width=100

    You get:

    height="100" width="100"

    Saves me time from adding extra code to make it XHTML friendly, just thought you might like to know...

    whoops...it's in the manual already.

  15. #15
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Oh boy...

    Anarchos,

    You just can't stand the "dumb newbies", can't you? You know so much, boy your momma must be very proud!

    You still don't get it do you!... Just because you are used to use php.net that doesn't mean others are too and if they are not boy they must be so dumb, right?

    I always found good advices at forums and that's why I use them.

  16. #16
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tubedogg,

    I use it with RedHat 7 all the time. Maybe its a PHP bug you have. How and when does it "Break"? Does it crash the server or return some error?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  17. #17
    SitePoint Zealot New Oddity's Avatar
    Join Date
    Jun 2001
    Location
    Georgia
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is also the imageSX(int IM) and imageSY(int IM) that return integer values for height and width...
    --Odd
    "We all live in a yellow subroutine."
    "Some call it insanity; I call it inspiration!"

  18. #18
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unforunately New Oddity in order to use those functions you will need to have the GD library compiled into your version of PHP. That function is part of the GD functions and not standard distro as GetImageSize() is.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  19. #19
    SitePoint Zealot New Oddity's Avatar
    Join Date
    Jun 2001
    Location
    Georgia
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah... I see. This is the bigest problem that I have run into when working with PHP. What is and is not compiled into PHP, and other things that I am using. I'm still fairly new to linux and am afraid to recompile the source for these things because I fear losing settings and other data... I'll eventualy become acustomed to this enviroment and thigs will run more smoothly... Thank you though.
    --Odd
    "We all live in a yellow subroutine."
    "Some call it insanity; I call it inspiration!"

  20. #20
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anarchos, I must say that I am pretty disappointed with your replies in this thread. Not that my opinion means much to you probably but I know that you are better than that.

    I agree that the best place to find out information concerning PHP is PHP.net. No one is going to argue you on that point. However, the SOLE reason that the SitePoint forums exist is so that users can ask questions of each other. Sure he could have gone over there, but what if he had difficulty finding the answer? Or what if he found the answer but wasn';t sure how to implement it in one of his scripts?

    I just went to the link that Freddy posted. It does not give the detailed breakdown of the array structure that Louie (Freddy) was kind enough to post. You could have just not posted to this thread if you thought that McSpike should do the work himself.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  21. #21
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Creole, my point is that he didn't try PHP.net; I would have no problem helping him if he weren't sure how to impliment it.

  22. #22
    SitePoint Enthusiast
    Join Date
    Nov 2000
    Location
    Allentown PA
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by freddydoesphp
    I use it with RedHat 7 all the time. Maybe its a PHP bug you have. How and when does it "Break"? Does it crash the server or return some error?
    It returns nothing, as if it can't process the image type (run non-supported image type through it). I've seen many servers have problems with it, such that vB had to make a workaround which creates another bug that's a major pain to fix... (and still isn't fixed 100%)

  23. #23
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The only thing I have found is that if you try to use HTTP path instead of a system path to the image it breaks, but other than that I use it successfully on RedHat 7, 6.1, 6.2 and Windows.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  24. #24
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fair enough, but we're here to learn and to help..at least I am. I know your posts are usually great, especially in the Javascript forum. That's why I said anything at all.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  25. #25
    SitePoint Member
    Join Date
    May 2001
    Location
    Hamburg, Germany
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I must say,
    I have learnt so much in this forum, just from reading through answers to the so-called "simple" questions.

    Functions I didn't know of, or that were used in a different way from what I am used to. If it wasn't for these questions then the forum would be a lot less helpful for "newbies" but also a lot more boring for the "others".

    Frank
    That' it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •