Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


possien last won the day on April 5 2014

possien had the most liked content!

Community Reputation

4 Neutral

About possien

  • Rank
    Regular Member

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
  • Interests
    PHP Javascirpt CSS Flying Drones, RC Planes, Motorcycle racing
  1. possien

    GD or SVG graphing math

    Ok, I finally got it now, understanding transform: function compass(){ $angle = array(0,45,90,135,180,225,270,315); for ($i = 0; $i <= 7; $i++) { $a = $angle[$i]; $Ox1 = 50; $Oy1 = 50; $rad = 40; $x = 50 + round($rad*cos(deg2rad($a))); $y = 50 - round($rad*sin(deg2rad($a))); //echo 'x= '.$x.' | y= '.$y.'<= for angle '.$a.'<br>'; $html = '<line x1="'.$Ox1.'" y1="'.$Oy1.'" x2="'.$x.'" y2="'.$y.'" style="stroke:red;stroke-width:2"/>'; $html = $html++; echo $html; } } ?> <svg id="svgelem" height="100" xmlns="http://www.w3.org/2000/svg"> <svg width="100" height="100"> <g transform="translate(0,100) scale(1,-1)"> <circle cx="50" cy="50" r="48" stroke="green" stroke-width="2" fill="#EFA" /> <?php compass();?> </svg> Thanks gizmola and Barand! Now to spherical trig...
  2. possien

    GD or SVG graphing math

    I think I am getting there, I changed the origin to x=0 and y=max of the plot area and for negative values origins are x=max and y = max of the plot area (separate SVG graphic). Thanks for the math help and links. I do believe SVG is much easier.
  3. possien

    GD or SVG graphing math

    I have tasking to produce graphs that convert polar coordinates to x,y and spherical trig plots. Since GD and SVG origins are inverted or backwards from a normal xy graph, is there a way to convert xy to GD or SVG using math? The calculations to plot in normal xy are relatively easy and some have negative values but I am not having success at putting the output to a usable display. Any suggestions? <!DOCTYPE html> <head> <title>SVG</title> <meta charset="utf-8" /> </head> <body> <h2>HTML5 SVG Plot Polar to XY Line</h2> <?php $rad = 25; $x = round($rad*cos(45)); $y = round($rad*sin(45)); echo "Value of x: ".$x."<br>"; echo "Value of y: ".$y."<br>"; echo "Plot of a 45 deg's with PHP in red, correct plot in blue"; ?> <svg id="svgelem" height="200" xmlns="http://www.w3.org/2000/svg"> <svg width="100" height="100"> <circle cx="50" cy="50" r="48" stroke="green" stroke-width="2" fill="#EFA" /> <line x1="50" y1="50" x2="<?php $x;?>" y2="<?php $y;?>" style="stroke:red;stroke-width:2"/> <line x1="50" y1="50" x2="100" y2="0" style="stroke:blue;stroke-width:2"/> </svg> </body> </html>
  4. possien

    Make a class or not

    I agree with everything after "proposing procedural masked by OOP", as mentioned there is a great deal to OOP and you have to start somewhere. I am sure in his CMS there would be several integrated classes and your description of the image class is spot on. You are correct in saying there is a great deal to OOP but the main point I was trying to make was group self-sustainable objects and as you indicated, in a reusable fashion.
  5. possien

    Make a class or not

    Generally I group related functions together in classes, for example you could create "class img_functions{...}" for your related functions to images. The same for db, send mail, time formats, etc. This allows you to create functions within the classes that actually help you use other functions within the class. Extending classes and other OOP related advantages. You can cut the number of includes by autoloading classes. In general you actually cut down the work required to generate pages. There are also name spaces that are useful if your code is incorporated in other php apps. You already have a good start with the use of functions. Check out the PHP manual on classes to give you an idea on what can be expanded and made easier and more helpful.
  6. possien

    Attaching image to email from form

    I would approach it a little differently. Rather than just email the webmaster with the info and pic, I would want something more permanent and extensible. For example something like: The customer fills out the form and submits a picture file (modify the form The customer receives an acknowledgement email The image is uploaded to a file location (/customer_image/some_pic.jpg) Database is used to capture the form information plus the filename of the image. Webmaster gets notified (and others) of inquiry. Webmaster goes to the query page and can review all customer queries and images (have to build page for this) Webmaster can click on customer link and respond to query (email response form). This response is also put in the database so if someone else needs the info or review. Additional responses to the customer could be sent from the response page and entered into the db. This would allow a permanent record of customer queries and responses. It takes a bit of work to send attachments in emails and would require a function being built to handle the mime types for attachments or you can find a package that provides this. With the amount of work, I would rather go with what I have described above. Either way you should update your functions file to use mysqli instead of mysql or use PDO, mysql is obsolete.
  7. possien

    Attaching image to email from form

    Can you post functions.php file? Are you using a database?
  8. possien

    Simple Frames

    You can play with this code and tweek it to meet your needs. There are better ways in HTML5 and CSS3 to do this but this will give you an idea of how it works. Basically you create divisions within sections by floating divisions left or right. The total width cannot exceed 100% . I.e., the margins + borders + plus division widths <= 100%. You can use px, em, etc. but the math is easier with % .If you use px or em the total width of the elements can't exceed the total of the body width. You have to clear the float after to display the next section correctly. There is a better way to clear them but this is just and example. The height of each section can be pre-determined for your header and footer but for your main div content it is generally determined by the content itself. <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Layout</title> <style> body{width:90%} #header{background:#ddd;height:200px;border:2px solid blue;} #header-right{float:right;width:32%;background:#555;height:200px;} #header-left{float:left;} #main{background:#98AFC7} .div-25{width:24%; background:#333;margin:.5%;border:2px solid blue;float:left;height:500px;} .div-50{width:48%; background:#ccc;margin: .5% 0;border:2px solid blue;float:left;height:500px;} #footer{height:200px;border:2px solid blue;} .clear{clear:both} </style> </head> <body> <div id="header"> <div id="header-right"><p>some text</p></div> <div id="header-left"><h1>Header</h2></div> <div class="clear"></div> </div> <div id="main"> <div class="div-25"></div> <div class="div-50"></div> <div class="div-25"></div> <div class="clear"></div> <div id="footer"></div> </div> </body> </html>
  9. possien

    clearing information

    So if the input box changes you want it to clear the value of 'title' and start new. You would have to compare the value of the text box to the previous input but you are hard coding the url for query. Does the url change?
  10. possien

    clearing information

    Your last line of code will keep appending the content with the previous content. Try something like: $("#artist").html(title);
  11. possien

    div alignments not right, no matter what I do.

    By default display:inline-block aligns on the bottom border. It also looks different in different browsers. Just a suggestion, you could simplify your css and put it the head section or a css page. You have a fixed width so you don't need a max width. <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <style type="text/css"> #Item_Output_Container{width:1670px;background-color:white;margin-top:25px;} .item{border:solid 5px; display:inline-block;width:150px;height:150px; padding:10px;font-size:10px;vertical-align:top;} </style> </head> <body> <div id="Item_Output_Container"> <div class="item"> 4-20 X 1 PHILLIPS PAN HEAD 48-2 TRILOBE THREAD FORMING SCREW CASE HARDENED STEEL TRIVALENT ZINC, BAKE & WAX ROHS COMPLIANT </div> <div class="item"> 6-19 X 1 PHILLIPS PAN HEAD 48-2 TRILOBE THREAD FORMING SCREW CASE HARDENED STEEL TRIVALENT ZINC, BAKE & WAX ROHS COMPLIANT </div> <div class="item"> 6-19 X 1 UNSLOTTED INDENTED HEX WASHER HEAD 48-2 TRILOBE THREAD FORMING SCREW CASE HARDENED STEEL TRIVALENT ZINC, BAKE & WAX ROHS COMPLIANT </div> </div> </body> </html>
  12. possien

    Repeating month

    Thats true, you can do a simple date difference and return an array containing year and month. (see the PHP manual). Not sure what he is trying to do.
  13. possien

    Repeating month

    I think I understand now. If you have for example $month = 36, that would be 2 years and 12 months, the maximum you need. So you would need to find the years and months up to that value: $month= 25; function month($month){ if($month < 13) { $month = $month; $year = 0; } elseif($month < 25){ $month = $month-12; $year = 1; } elseif($month < 37 ){ $month = $month-24; $year = 2; } echo 'Month: '.$month.'<br>'; echo 'Year: '.$year; } month($month); So, is this what you are trying to do? You can add $year to the current or other date plus get the month. THis evaluates from the lowest to highest value of $month.
  14. possien

    Repeating month

    If you are extracting month from date('m') it's never going to be greater than 12?
  15. possien

    Repeating month

    Are you just trying to return $month plus 1 and if $month is 13 it becomes 1? $month = date('m'); function month($month){ $month = ++$month; if($month >12)$month = 1; return $month; } echo month($month);

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.