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. :/
  8. mod_alias did not show in my search of phpinfo. ill speak to godaddy about this. i havent tried setting up the redirects in cpanel because there are many. and i was hoping i might learn something new from this exercise.
  9. im assuming i might need true root access to check if mod_alias is enabled after reading this: http://serverfault.com/questions/568267/how-to-check-if-mod-alias-is-enabled but godaddy does not allow for that in their shared hosting plans, i dont believe.
  10. i searched a phpinfo() file for mod_alias but didnt find it. where can i see if this is enabled? dont know where to find redirect logs? i looked in my cpanel but not there. no onscreen errors. other than the 404. i AM being directed to my custom 404 page which leads me to believe .htaccess is working, in general.
  11. i frequently use .htaccess files for some basics but i am very newbish in my understanding. what i am trying to do is setup permanent redirects for old file names to new ones on the same server/domain. the line below typically works for me but i cannot get any success on a particular client's account. it is a GoDaddy shared hosting Linux server. has apache and other .htaccess directives are working. i have been researching online about this and so have tried numerous alternatives such as redirectmatch-es and RewriteRule-s. not that i understand the aforementioned well but read an article on two that explained things fairly well and so gave it a shot but no luck. i did find a bunch of statements alluding to some changes GoDaddy made that require the inclusion of subfolders in the command but had no success with it. this domain, mysite.com, is setup as a subdomain (in 'subfolder') under what GoDaddy is calling the 'root' directory. Redirect /subfolder/old_file.php http://mysite.com/subfolder/new_file.php
  12. thank you maxxd. that is the solution i was looking for
  13. addendum: seems like allow_url_include=on permits remote includes. i understand thats bad. :/
  14. ill try to explain what im trying to do and why a little better. when im developing a site on a test server, the current project might be buried in a sub directory. so my include path might look something like: 'http://mydomain.com/dev/2/incs/header.php'. eventually the production server might have my project at the root level. so i want my include path to look like this: 'http://mynewdomain.com/incs/header.php'. rather than rewriting include paths on each file when the project is moved to production, i wanted to prepend a variable string to the filename that is in one central place. so in a settings.php file i define a CONSTANT: define( 'C_URL', 'http://mydomain.com/dev/2/' ); i then use that constant in all of my include statements as such: include( C_URL . 'incs/header.php' ); therefore, whenever the project is moved, i only have to make a one-time change to the constant definition in settings.php. ive read in other forums that using variables in an include statement ( include( $url . 'incs/header.php' ); ) is a security risk but constants are not. but having no luck. i will check to see if allow_url_fopen and allow_url_include settings are turned on. but it sounds like some of you are advising me NOT to pursue this course. is it a security risk? or bad practice for some other reason?
  15. i have the constant defined with the slash: define( 'C_URL', 'http://mydomain.com/' );
  16. i dont know if im having a brain fart or maybe server settings are interfering. i have an include statement such as: include( C_URL . 'incs/header.php' ); i echoed out the constant C_URL after the include statement to make sure it is assigned and it seems to be. however, the file is not being included. i belive it is interpreting my path literally. so it includes 'C_URLincs/header.php' instead of 'http://mydomain.com/incs/header.php'. help is appreciated!
  17. thx scoots. i understand this. i spoke about it in my initial post. but the client would still like to DETER the average user. these paying members are educators, not developers. chances are they are not familiar with OCR tools. operative word here is 'deter', not 'prevent'.
  18. I have a client that wants to provide pdf documents to their paying members only. They do not want these pdf documents redistributed, copied, printed, etc. I explained that to the best of my knowledge, there is no way to prevent redistribution once the user views the document. You can mitigate, but not stop 100%. So the steps they would like to take are: 1. to have a custom watermark on each page of a multi-page pdf booklet. basically the Users account credentials on our local database would be used as textual data to overlay on each page. 2. to deter replication of the document contents. I believe there is software that can convert pdf fonts/content to graphic files and/or flash elements to prevent copy-n-paste. 3. the solution has to be PHP based. there are thousands of pages so we, of course, do not want to do the above manually.
  19. i dont know much of anything about video. im trying to embed an HTML 5 <video> element. the original file is in .mov format. both video and audio seem fine in this original. im told this is not compatible with the HTML 5 <video> element so my best bet is to convert it to mp4. im using VLC player: http://www.videolan.org when i convert the .mov to .mp4, the file both locally on my machine (windows media player) and on my webpage plays the video with no audio. someone else told me to just simply rename the file from a .mov extension to a .mp4 with no 'conversion' necessary. when i do this, the file plays both video and audio on my machine locally but still no audio on my webpage. anyone that can offer any help?
×
×
  • 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.