Jump to content

kirkh34

Members
  • Posts

    80
  • Joined

  • Last visited

Everything posted by kirkh34

  1. hello all, i have a function to copy a png 24 while preserving transparency and recolor the image and save a new file. the color works but the image edges become fuzzy. i'm not entirely sure what is causing this. i'd like to have the same quality as the original image with clean edges. love to hear suggestions. thanks a lot <?php function color_png($src_string, $directory, $r, $g, $B){ $im = imagecreatefrompng($src_string); imageantialias($im, true); $width = imagesx($im); $height = imagesy($im); $imn = imagecreatetruecolor($width, $height); imagealphablending($imn,false); $col=imagecolorallocatealpha($imn,255,255,255,127); imagesavealpha($imn,true); imagefilledrectangle($imn,0,0,$width,$height,$col); imagealphablending($imn,true); imagecopy($imn, $im, 0, 0, 0, 0, $width, $height); imagefilter($imn, IMG_FILTER_NEGATE); imagefilter($imn, IMG_FILTER_COLORIZE, $r, $g, $B); imagepng($imn, $directory); imagedestroy($imn); } ?>
  2. I'm confused at what you mean? run one query at the start of what? I need the title_id in the array. I must use that loop?
  3. thank you for your replies. I understand that it is wrong to run queries in loops, but I am not sure how I would complete it otherwise? I have to run that foreach loop in order to get the title_id needed to run the query. Can you explain a different structure that would work for what I need?
  4. Hello. I have a table title_views with each row being a "view" with a user_id, title_id, prog_id, date, and id. I want to gather just the user_ids without it returning duplicate user_ids. Right now I'm receiving duplicate user_id. Any help is appreciated. Thank you. <?PHP include("db.php"); $qry= mysql_query("SELECT * FROM programs") or die (mysql_error()); while($row = mysql_fetch_array($qry)){ $prog_titles = $row['titles']; $prog_titles = explode(',' , $prog_titles); $prog_id = $row['prog_id']; array_shift($prog_titles); foreach($prog_titles as $prog_title){ $trimmed = trim($prog_title); $qry= mysql_query("SELECT DISTINCT user_id FROM title_views WHERE title_id = '$trimmed' and prog_id = '$prog_id' ") or die(mysql_error()); $row = mysql_fetch_array($qry); echo $row['user_id'] . "<br />"; } // end foreach } //end while ?>
×
×
  • 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.