Jump to content

BuildMyWeb

Members
  • Posts

    188
  • Joined

  • Last visited

Everything posted by BuildMyWeb

  1. i havent looked into the example you linked bintje but you certainly could achieve most, if not all, of thsoe animations with CSS3: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_animations https://css-tricks.com/almanac/properties/a/animation/ animations are tricky to work with in the current browser environment. they are not fully supported yet and such. i know of particular issues with mobile IOS 8.x.x.
  2. so i am developing an app where users submit content that is categorized by region. we then have a viewing page where 50 most recent submissions are displayed in a carousel for each region. so imagine if we have 5 regions, we thusly have 5 carousels, each with 50 most recent submissions. i imagine in the scenario above, i will need 5 separate SELECT statements that look for each particular REGION? any more efficient way to accomplish this other than 5 calls to the server? $query = "SELECT * FROM ( SELECT file_name, region, content, user_ip FROM table WHERE region=? ORDER BY id DESC LIMIT 50 ) sub ORDER BY id ASC"; secondarily, this presents an issue i contend with whenever working with sql projects. i imagine faster indexing with 5 smaller tables, one for each REGION, as opposed to one large table with a REGION column is the way to go. but i dont really have much experience to say anything with certainty. one table or 5?
  3. Thanks Barand. that did it. and i learned something new!
  4. just started messing with the php images tonight so this is a mess. ive been patching together bits and pieces from scripts i found online and reading the PHP Manual to get something that prints graphic text with transparency for me, as expected. what im not understanding, is how the background color is dictated. my desire is to have no background. so ive been trying to make it transparent. with no luck. what i want: text with say, only 10% transparency so that i can use it as a watermark. no background to the text at all what im getting: the transparent text but a solid black bg. i cant even get the background color to change, much less have transparency. Header("Content-type: image/png"); class textPNG { var $font = 'font/Avant Garde Demi BT.ttf'; //default font. directory relative to script directory. var $msg = "no text"; // default text to display. var $size = 88; // default font size. var $rot = 33; // rotation in degrees. var $pad = 110; // padding. var $transparent = 1; // transparency set to on. var $red = 255; // black text... var $grn = 255; var $blu = 255; var $bg_red = 255; // on white background. var $bg_grn = 255; var $bg_blu = 255; function draw() { $width = 0; $height = 0; $offset_x = 0; $offset_y = 0; $bounds = array(); $image = ""; // get the font height. $bounds = imagettfbbox($this->size, $this->rot, $this->font, "W"); if ($this->rot < 0) { $font_height = abs($bounds[7]-$bounds[1]); } else if ($this->rot > 0) { $font_height = abs($bounds[1]-$bounds[7]); } else { $font_height = abs($bounds[7]-$bounds[1]); } // determine bounding box. $bounds = imagettfbbox($this->size, $this->rot, $this->font, $this->msg); if ($this->rot < 0) { $width = abs($bounds[4]-$bounds[0]); $height = abs($bounds[3]-$bounds[7]); $offset_y = $font_height; $offset_x = 0; } else if ($this->rot > 0) { $width = abs($bounds[2]-$bounds[6]); $height = abs($bounds[1]-$bounds[5]); $offset_y = abs($bounds[7]-$bounds[5])+$font_height; $offset_x = abs($bounds[0]-$bounds[6]); } else { $width = abs($bounds[4]-$bounds[6]); $height = abs($bounds[7]-$bounds[1]); $offset_y = $font_height;; $offset_x = 0; } //$image = imagecreate($width+($this->pad*2)+1,$height+($this->pad*2)+1); $image = imagecreatetruecolor($width+($this->pad*2)+1,$height+($this->pad*2)+1); // Turn off alpha blending and set alpha flag imageSaveAlpha($image, true); ImageAlphaBlending($image, false); //$background = imagecolorallocate($image, $this->bg_red, $this->bg_grn, $this->bg_blu); //$foreground = ImageColorAllocate($image, $this->red, $this->grn, $this->blu); //$background = imagecolorallocatealpha($image, $this->bg_red, $this->bg_grn, $this->bg_blu, 127); $background = imagecolorallocatealpha($image, 255, 255, 255, 127); $foreground = imagecolorallocatealpha($image, $this->red, $this->grn, $this->blu, 100); if ($this->transparent){ imagecolortransparent($image, $background); } imageinterlace($image, false); // turn alphblending back on before laying text ImageAlphaBlending($image, true); // render the image imagettftext($image, $this->size, $this->rot, $offset_x+$this->pad, $offset_y+$this->pad, $foreground, $this->font, $this->msg); // output PNG object. imagepng($image); imagepng( $image, "bmw_img.png" ); // save img to file } } $text = new textPNG; //$text->red = '111'; //$text->grn = '111'; //$text->blu = '111'; if (isset($msg)) $text->msg = $msg; // text to display if (isset($font)) $text->font = $font; // font to use (include directory if needed). if (isset($size)) $text->size = $size; // size in points if (isset($rot)) $text->rot = $rot; // rotation if (isset($pad)) $text->pad = $pad; // padding in pixels around text. if (isset($red)) $text->red = $red; // text color if (isset($grn)) $text->grn = $grn; // .. if (isset($blu)) $text->blu = $blu; // .. if (isset($bg_red)) $text->bg_red = $bg_red; // background color. if (isset($bg_grn)) $text->bg_grn = $bg_grn; // .. if (isset($bg_blu)) $text->bg_blu = $bg_blu; // .. if (isset($tr)) $text->transparent = $tr; // transparency flag (boolean). $text->draw();
  5. ive been working on this off and on for two days. finally figured it out. for anyone who references this thread, here is the solution: function refValues($arr){ if (strnatcmp(phpversion(),'5.3') >= 0) //Reference is required for PHP 5.3+ { $refs = array(); foreach($arr as $key => $value) $refs[$key] = &$arr[$key]; return $refs; } return $arr; } $arr_values = refValues($arr_values); http://stackoverflow.com/questions/16120822/mysqli-bind-param-expected-to-be-a-reference-value-given
  6. i cannot seem to figure out how to pass my array of values here. i get the following error(s): Warning: Parameter 2 to mysqli_stmt::bind_param() expected to be a reference, value given in ... on line 54 Fatal error: Uncaught exception 'ReflectionException' with message 'Invocation of method mysqli_stmt::bind_param() failed' in ... ReflectionMethod->invokeArgs(Object(mysqli_stmt), Array) #1 {main} thrown in ... $action = clean_string( $_POST['action'] ); $user_select = $_POST['user_select']; if( empty($action) ) { header('Location: ' . C_REF . '?msg_raw=act'); exit(); } else { $in = '?'; $types = 'si'; $arr_values = array($action, $user_select[0]); for( $i=2; $i < count($user_select)+1; $i++ ) { $in .= ', ?'; $types .= 'i'; $arr_values[] = $user_select[$i-1]; } array_unshift($arr_values, $types); $sql = "UPDATE users SET status = ? WHERE id IN (" . $in . ")"; $stmt = $db_connect->prepare($sql); $ref = new ReflectionClass('mysqli_stmt'); $method = $ref->getMethod("bind_param"); $method->invokeArgs($stmt,$arr_values); $stmt->execute(); } // close else
  7. im not able to make heads or tails of what your problem is or what you need. i imagine that is why others might be passing you over too. might help if you explain a bit more. :/
×
×
  • 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.