Jump to content

mcmuney

Members
  • Posts

    358
  • Joined

  • Last visited

Contact Methods

  • AIM
    mcmuney
  • Website URL
    http://www.4yn.com

Profile Information

  • Gender
    Not Telling

mcmuney's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. I'm using a gd library script to resize images that are uploaded. -All images that are uploaded are renamed with a .jpg extension. -When the original images is .jpg or .jpeg, I can see the image and resize it without any issues. -But when the original image is a .gif or a .png, I cannot view or resize the image -I'll get an error, "JPEG library reports unrecoverable error.. $filename is not a valid JPEG file" -This is the line that tells it to look for jpg/jpeg file: $func = 'imagecreatefrom' . ($ext == 'jpg' ? 'jpeg' : $ext); -If the original is a .png, if I replace the 'jpeg' above with 'png', then it works, but obviously, it no longer works with .jpg files My question, how can I modify the line above to specify for jpg, jpeg, png and gif? I tried this, but it wouldn't work: $func = 'imagecreatefrom' . ($ext == 'jpg' ? 'jpeg' ? 'png' ? 'gif' : $ext); Here's the full portion of the code: function loadImage($filename) { $ext = strtolower($this->_getExtension($filename)); $func = 'imagecreatefrom' . ($ext == 'jpg' ? 'jpeg' : $ext); if (!$this->_isSupported($filename, $ext, $func, false)) { return false; } $this->_imgOrig = $func($filename); if ($this->_imgOrig == null) { $this->_debug("The image could not be created from the '$filename' file using the '$func' function."); return false; }
  2. I'm using the code below, which displays the most recent 15 results. I'd like to modify it so that it displays the most recent 15 results in random order. How can I achieve this within the code below without having to use another query? SELECT mem_id,type_id,date_added,value FROM sc_coins_asset WHERE value<>'0' ORDER BY date_added DESC LIMIT 0,15
  3. What I'm trying to do involves 3 tables: Table1: id, status Table2: id, value Table3: id, value1, value2 Step1: Pull all unique id numbers where status=1 from Table1 Step2: For each id pulled in Step1, insert a value=(random number between 1-5; important: the random number should be different for each insert for each id) into Table2 Step3: For each id and value inserted in Step2, update in Table3 where Table3.id=Table2.id set value1=(existing value +1) and value2=(existing value +the random value inserted in Step2 Any guidance would be greatly appreciated. Thanks.
  4. On a single page, I have 2 functions: 1) one is similar to a FB wall, where users click to post a comment and the textarea appears on click and posts on submission 2) it's a modal window that opens on click and users enter text and submits, and on submit, the modal window closes and the page refreshes automatically The below code is what's at the very top of the page, which are lines 1-7. When line 5 is in its current position, option 1 above works as expected, but option 2 does not work properly. On submit, the modal window does not close and the page doesn't refresh automatically. However, if I move line 5 and place it on line 1, option 2 works as expected, but on option 1, the textarea does not appear on click and users can't post. What could be the conflict? Thanks. <script type="text/javascript" src="ajax/modal_window/js/ajax.js"></script> <script type="text/javascript" src="ajax/modal_window/js/modal-message.js"></script> <script type="text/javascript" src="ajax/modal_window/js/ajax-dynamic-content.js"></script> <script type="text/javascript" src="ajax/prototype.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.oembed.js"></script> <script type="text/javascript" src="js/wall.js"></script>
  5. That's all the code. This executes when the page has.. example.php?ft=1 (anytime ft>0). It's the insert portion that's executing twice.
  6. I'm using the code below to insert data into my DB, but it's executing twice. Not as a duplicate, but with it's own unique line. How can I fix this? if($ft>0) { $ft="UPDATE sc_member SET mem_feature_flag='1' WHERE scm_mem_id='$ft'"; $res=$db->update($ft); // SEND MESSAGE $time=time(); $ft=$_GET['ft']; $txt_sb_body="Hey ".$fname.", You have been featured! Keep up your activity! {automated message}"; $sql="INSERT INTO sc_messages (`smg_from`, `smg_to`, `smg_subject`, `smg_body`, `smg_sent_del`, `smg_postdate`, `scm_bulletin`, `send_cron`) VALUES ('1','$ft','Featured Alert','$txt_sb_body','1','$time', '6', 'N')"; $result = mysql_query($sql); }
  7. I need to use in/then statements using PHP. For example, if($width>1280){ //do X }else{ //do Y. Even though it's displaying the right width, it's not seeing the value as a number; therefore, treating it as a 0.
  8. I'm pulling the resolution by using java and displaying it via php, which works. However, when I want to add/substract, it treats to value ($width) as zero. In the example below, I need "echo $width+1" to = 1281 (currently = 1). How can I make that happen? <?php $width='<SCRIPT language="JavaScript"> <!-- width = screen.width; document.write(width); //--> </SCRIPT>'; echo $width; //this shows resolution, ie 1280 echo $width+1; //this shows 1 ?>
  9. It's a mysql database. It's a text field, but I'm not sure why the ? would be an issue.
  10. I have the code below in a script where descriptions can be added to an image, which is referenced in the code as a comment. Everything seems to work fine, EXCEPT when there is a "?" in the comment, in which case, the second update doesn't execute. Any idea why and any solution to this problem? $db->update("UPDATE `sc_member_images` SET ordering=-1 WHERE scm_mem_id='{$social_mem_id}'"); for($i=0;$i<count($_POST['p']);$i++) { $q="UPDATE `sc_member_images` SET ordering='".($i+1)."',sci_caption='".addslashes($_POST['p'][$i][comment])."' WHERE sci_id='{$_POST['p'][$i][image]}'"; $db->update_data($q)or die(mysql_error()); }
  11. I recently had a domain change and I have many posts that reference the old domain. What would be the easiest way to do a edit replace, where if "xyz.com" exist, replace it with "abc.net". Nothing else should change. Thanks.
  12. I'm using this piece of code: <script> function window_open(passed_value) { if(confirm("Confirm?")) { window.open('view_full_image.php?imgid='+passed_value+'&mem_id=<?=$_GET['scm_mem_id']?>','','top=50,left=50,width=600,height=600,scrollbars=yes'); window.opener.location.href=window.opener.location.href; // refresh the main page window.opener.focus(); // focus on the main page return false; } return false; } </script> It's basically supposed to do 2 things when the alert is confirmed or "Ok" is pressed: -let's say that this code is on "domain.com/view_image.php" 1) opens a popup window (view_full_image.php) and.. 2) refresh the page that it's on, which is domain.com/view_image.php This works fine on Firefox; however, on IE, #2 doesn't work properly. Instead of refreshing the page, it goes to the root domain. For example, instead of refreshing domain.com/view_image.php, it'll refresh to domain.com. What's causing this compatibility issue?
  13. Yes, I'm reloading the <div> section via ajax, which loads a new image. But after a reload, the image load on the fancybox stops working, even though the java is outside of the <div> that's reloading withing the page.
  14. I have a scenario where the javascript stops working once a section of a page is reloaded. For example: <javascript> some java code to open an image usina a fancy window </script <div id="reload_section"> <a href="image" id="java-fancy-window" onclick="java-fancy-windo"><img src="image"></a> </div> <a href="reload_section_page">RELOAD SECTION</a> I'm using something like this and when I click on the image, it opens the image in a nice popup window; however, when the <div> section is reloaded, the same function stops to work. I've even tried placing the java code again inside the page that's reloaded inside the <div>, but it still does not work. Any ideas?
  15. I'm trying to pull a certain number of characters after a specific character. For example: $data="x=1234567" I'd like to pull 7 characters after "x=". So the result whould be "1234567". I couldn't use strpos because the 7 characters will NOT always begin from the 3rd character. For example, it could be "x=" or "tyx=" or "1x=", etc. I only want what's after "x=". Thanks.
×
×
  • 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.