Results 1 to 7 of 7

Thread: PHP Help

  1. #1
    ATO Member HarryChiling's Avatar
    Join Date
    Apr 2005
    Location
    Nowhereville
    Occupation
    Other Eyecare-Related Field
    Posts
    7,765

    PHP Help

    OK, so here is my problem. I am trying to create an image using PHP and code to create it. The idea is it is going to be able to take variables and create the image. Here's the prblem I keep running into:

    PHP Code:
    $cx Center of image width
    $cy 
    Center of image height
    $r 
    Calculation for the radius of curvature in mm
    $sag 
    Calculations for the sag of the curve
    $diam 
    Diameter of the lens
    $ang 
    rad2deg(atan((diam/2)/$r))
    $sy $cy $r -$sag
    ImageArc
    ($id$cx$sy$r$r, (270-$ang), (270+$ang), $black); 
    This should make a circle at the point (x,y) = [$cx, $sy], my problem is that the $sy point will often go outside of the size of the image for instance if the height of the image was 500px, the $sx could at times equal 600 or more which would go outside of the image. It seems that when i go outside fo the image bounds the arc won't display in my image. This has been bugging me for a while now. Here was a workaround I thought of, use overlapping div's on the page to block out the area of the image I don't want viewable, and increaseing the bounds of my image, but then I will have more codeing to do to get the center points to be on the visible center of the image which will then further the complications in the arc's (x,y) start point.

    Any PHP guru's here that could help?
    1st* HTML5 Tracer Software
    1st Mac Compatible Tracer Software
    1st Linux Compatible Tracer Software

    *Dave at OptiVision has a web based tracer integration package that's awesome.

  2. #2
    Master OptiBoarder
    Join Date
    Feb 2007
    Location
    NC
    Occupation
    Dispensing Optician
    Posts
    3,951
    Huh? The only thing I recognize here is the $ sign. :bbg: Sorry.

  3. #3
    ATO Member HarryChiling's Avatar
    Join Date
    Apr 2005
    Location
    Nowhereville
    Occupation
    Other Eyecare-Related Field
    Posts
    7,765
    Quote Originally Posted by obxeyeguy View Post
    Huh? The only thing I recognize here is the $ sign. :bbg: Sorry.
    Yeah I figured it was th wrong forum, but I like this one better than the PHP forums. I figured it out anyway I am going to put the image in a HTML frame enclosed in a div and the div does allow the image to be placed within it in in negative space so I will have the image size be dynamic and dependent upon the radius, and then use the div to crop any portion of the image that I don't need.

    I was just hoping to keep all the code within the image so I could have others link to it and use it.
    1st* HTML5 Tracer Software
    1st Mac Compatible Tracer Software
    1st Linux Compatible Tracer Software

    *Dave at OptiVision has a web based tracer integration package that's awesome.

  4. #4
    OptiBoardaholic
    Join Date
    Feb 2006
    Location
    Indonesia
    Occupation
    Optical Laboratory Technician
    Posts
    250
    Quote Originally Posted by HarryChiling View Post
    Yeah I figured it was th wrong forum, but I like this one better than the PHP forums. I figured it out anyway I am going to put the image in a HTML frame enclosed in a div and the div does allow the image to be placed within it in in negative space so I will have the image size be dynamic and dependent upon the radius, and then use the div to crop any portion of the image that I don't need.

    I was just hoping to keep all the code within the image so I could have others link to it and use it.
    Where can I find the images for web? Just like Home, Tel, Email or Contact Us and so on. Thanks.

  5. #5
    ATO Member HarryChiling's Avatar
    Join Date
    Apr 2005
    Location
    Nowhereville
    Occupation
    Other Eyecare-Related Field
    Posts
    7,765
    Quote Originally Posted by Samuel Jong View Post
    Where can I find the images for web? Just like Home, Tel, Email or Contact Us and so on. Thanks.
    You could purchase the right to use them from a desinger just google search "Web Graphics" or "Icons". You could make them yourself. Or you could use Creative Commons Copyrighted material like this one: http://www.openwebgraphics.com/graphics read more about CC Copyrights at http://creativecommons.org/
    1st* HTML5 Tracer Software
    1st Mac Compatible Tracer Software
    1st Linux Compatible Tracer Software

    *Dave at OptiVision has a web based tracer integration package that's awesome.

  6. #6
    OptiBoardaholic
    Join Date
    Feb 2006
    Location
    Indonesia
    Occupation
    Optical Laboratory Technician
    Posts
    250
    Quote Originally Posted by HarryChiling View Post
    You could purchase the right to use them from a desinger just google search "Web Graphics" or "Icons". You could make them yourself. Or you could use Creative Commons Copyrighted material like this one: http://www.openwebgraphics.com/graphics read more about CC Copyrights at http://creativecommons.org/
    Thanks Harry.

  7. #7
    OptiBoard Professional jrumbaug's Avatar
    Join Date
    Dec 2007
    Location
    Huntington, WV
    Occupation
    Dispensing Optician
    Posts
    137

    possible error

    I see

    $ang = rad2deg(atan((diam/2)/$r))

    shouldn't there be a $ in front of the variable "diam"?

    $ang = rad2deg(atan(($diam/2)/$r))

    Jim Rumbaugh



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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
  •