Jump to content

marvelade

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

marvelade's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. There are also hosters that keep register_globals On, but that generally means that their service sucks. Find one hosting partner that u are comfortable with (preferrably *not* a free one); they should have enough PHP expertise to realise what decent settings are instead of basing their settings on some blog post saying that PDO is not implemented well in PHP4 (while they ru PHP5) and that register_globals is a handy tool for developers... Most hosting companies know a lot about Linux/apache but nothing about PHP, unfortunately. greetz, Marv
  2. I've redesigned my code but even weirder things happen now. I'll keep on trying and will post again when I run into a definable problem. greetz, Marv
  3. parallel to studying PHP you really should also get basic knowledge on MySQL databases.
  4. And chances are, if <? ?> doesn't work, <?= ?> will also not work.... better straighten this out first.
  5. it's a short tag for echoing variables <?= $var ?> is the short hand for <?php echo $var; ?> grtz, Marv
  6. just leave out the else: if ($total=="10") { echo "<td><p><font face=arial color=red size=7>Execllent <br></font>"; } else isn't mandatory. grtz, Marv
  7. So we are talking about XSS here? I hope your mail administrator won't suspend u for that. Chances are that he checks HTTP_REFERER and if that's not in the same domain you can't log in. At least that's how I like to code my login forms. grtz, Marvelade
  8. Hi All, I'm struggling with an image-operation. I'm trying to scale, flip, move and rotate an image. However the imagerotate function is bugging me. Because imagerotate() also moves the image down in relation to it's container we have to cancel that movement out. the implicit movement equals the width of the original image, multiplied by the sine of the rotation angle so I subtract that amount from my delta_y. Here's the code: <?php $scale = isset($_GET['scl']) ? floatval($_GET['scl']) : 0.8; $delta_x = isset($_GET['dx']) ? intval($_GET['dx']) : 10; $delta_y = isset($_GET['dy']) ? intval($_GET['dy']) : 20; $rotation = isset($_GET['rot']) ? intval($_GET['rot']) : 30; $flip = isset($_GET['flip']) && $_GET['flip']=="true" ? true : false; define("OUTPUTIMAGE", true); // manipulate original image // get the name $userpic_path = "../userpics/waldo.jpg"; // convert to image resource $userpic_image = imagecreatefromjpeg($userpic_path); // prepare the container $userpic_size_array = getimagesize($userpic_path); $old_width = $userpic_size_array[0]; $old_height = $userpic_size_array[1]; $im = imagecreatetruecolor($old_width, $old_height); // move, scale & flip $new_width = $old_width * $scale; $new_height = $old_height * $scale; if($rotation != 0) { //imagerotate() performs an implicit move so we have to cancel that out $rotation_radians = $rotation * (M_PI / 180); $delta_y -= $new_width * sin($rotation_radians); } imagecopyresampled($im, $userpic_image, $delta_x, $delta_y, 0, 0, $new_width, $new_height, $old_width, $old_height); // prepare the transparent color $transp = imagecolorallocatealpha($im, 0, 0, 0, 0); // rotate $im = imagerotate($im, $rotation, $transp, false); if(OUTPUTIMAGE) { header("Content-type: image/png"); imagepng($im, "", 0); imagedestroy($im); } ?> The result can be found here: http://www.marvelade.com/projects/devoslemmens/imgcrop/pages/png_generator.php?scl=1&dx=0&dy=0&rot=45&flip=false feel free to play around with the GET variables as you please. the original image is here: http://www.marvelade.com/projects/devoslemmens/imgcrop/userpics/waldo.jpg All help, remarks, comments are very much appreciated. Best regards and thanks in advance, Marvelade
  9. 1) For a more readable output do this instead: echo '<pre>' . print_r($result,true) . '</pre>'; 2) When you've completed a tutorial on how associative arrays work you will understand. there's tons of explanations on the internet far better than waht I can explain here 3) .= means you glue a string to another variable $a = "Hello"; $a.= " Moon"; echo $a; // this will output "Hello Moon". actually this: $a .= " Moon"; does the same as $a = $a . " Moon"; but it's a little shorter to write. greetz, Marv
  10. your 2 snippets checks 2 different things, but since PHP is such a forgiving language (except when u forget a semicolon ;-) ) it will evaluate the existance of a variable as not false and the abscence of it as not true. Other languages would just say "argument should be of type BOOLEAN" or something similar. PHP does its best to try to figure out what you mean if it's not what it expects. grtz, Marv
  11. Just put dollar signs in front of the variables, remove the stars and turn on E_WARNING; that should tell you when a non-declared variable is used. I don't know what eff% means in CF tho. If you have more questions, just shoot grtz, Marv
×
×
  • Create New...

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.