Jump to content

dadamssg

Members
  • Posts

    729
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dadamssg's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. when they upload the image...i rename it then put that name in my database in the row for that event. I have a column field "Picture". an example text in it would be something like "1248324900LAdmin456.png"
  2. I have a script that resizes images the the user uploads...it works good, except for jpg's and some gif's. It doesn't capture the size of the picture and i have no idea why! i have this to recognize which type of image it is and then creates an image from that and then gets the dimensions. But it doesn't work for jpgs and gifs. if(preg_match('/[.](jpg)$/', $newname)) { $im = imagecreatefromjpeg($path_to_image_directory . $newname); } else if (preg_match('/[.](gif)$/', $filename)) { $im = imagecreatefromgif($path_to_image_directory . $newname); } else if (preg_match('/[.](png)$/', $filename)) { $im = imagecreatefrompng($path_to_image_directory . $newname); } $final_width_of_image = 200; $path_to_thumbs_directory = 'images/thumbs/'; $ox = imagesx($im); $oy = imagesy($im); echo $ox."<br>"; echo $oy."<br>"; $nx = $final_width_of_image; $ny = floor($oy * ($final_width_of_image / $ox)); $nm = imagecreatetruecolor($nx, $ny); i echo the dimensions to see what they are and it doesn't echo out anything for certain images. Works great for png's as far as i know. anybody know of anything i can do to resize an uploaded image?
  3. wait....just kidding...uploading the file to the freaking wrong directory...works perfect, thank you!
  4. i just tried both of these with no luck... function grabNumbers($str){ preg_match('#^\d+#', $str, $match); return $match[0]; } $file = '324559823759admin235.png'; echo grabNumbers($file); // Output: 324559823759 function grabNumberss($str){ list($number,$string) = sscanf($str, "%d%s"); // if using a 64-bit system simply return $number - otherwise, return str_replace($string, '', $str); // we remove string from filename instead } $file = '324559823759admin3465.png'; echo grabNumberss($file); // Output: 324559823759
  5. ok...what about if i had an image with this name 1248840000Admin614.png (notice the numbers after the Admin) would both of those just return the front number? cause thats what i need if so...you're awesome
  6. i'm thinking about naming the images after the timestamp that they end at. So if the event ends now it would be something like "1248218825admin3433.png". The long number would be the ending timestamp then the creator then the event id. This would make a unique image name. I could then use a function(that i have no idea how to write) to grab that front timestamp and check to see if that event and its image has expired...if so then unlink. This way the image deleting cron could run without relying on the database at all. Your thoughts??
  7. i've never seen "$id_*"...what exactly is that? does that look for files with those certain numbers at the beginning and doesn't matter whats after?
  8. ok i think im starting to see...i didn't know that glob function existed. So i guess, to make things easier, i could just rename the images that the people upload to be 'the-event-id-number.png'. i so then i would... 1. select all expired events and grab their id numbers 2. search through the directory with those id-numbers.png 3. unlink them step 2 is a little blurry to me though After step 1 i would have an array with id numbers...but how would use that array of just numbers(i.e. 3123, 2342, 2324) to search through and delete those found in the directories with those id numbers that have .png attached to them?
  9. I'm attaching images to events. And im going to name the events the timestamp that they end at and then attach the creators login name. So an example would be 324559823759admin.png I know that "timestamp" probably isn't legit but...i need a function that will grab all those beginning numbers up until it hits a letter...so the function would return "324559823759" in this case if "324559823759admin.png" was inputted. I have no clue how to do this...does anybody???
  10. oh and you would probably want to make $skin a session variable $_SESSION['skin']
  11. not sure i follow. i get what you're saying about the naming of the image. but not sure how i would search them...heres my simple cron delete script <?php $cxn = mysqli_connect($host,$user,$passwd,$dbname) or die ("Couldn't connect"); $query = "DELETE FROM events WHERE end < NOW()"; $rsult = mysqli_query($cxn,$query) or die (mysqli_error($cxn)); ?>
  12. you would do something like this <?php //query they database to find out their skin choice //then set that to a variable to like $skin ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Whatever | Whatever</title> <link rel="stylesheet" type="text/css" href="<?php echo $skin; ?>" /> you would need to have different skins already done up so the possibilities would be like...blue.css, pink.css, green.css
  13. I have a database that stores events and the event submission works fine. I do a cron to delete all the events that have ended. But now i'm developing an image upload feature for an event. So...someone creates an event and now they have the option to upload a picture to accompany it. As the pictures are completely separate from my database, i can't figure out the best way to delete them. Cause i want the pictures to be deleted along with the expired events and a cron would be excellent if i figure the theory out. Anybody have any ideas?
  14. I have a database that stores events and it works fine. I do a cron to delete all the events that have ended. But now i'm developing an image upload feature for an event. So...someone creates an event and now they have the option to upload a picture to accompany it. As the pictures are completely separate from my database, i can't figure out the best way to delete them. Cause i want the pictures to be deleted along with the expired events and a cron would be excellent if i figure the theory out. Anybody have any ideas?
  15. hey thanks that helped...what exactly does the overlow part do?
×
×
  • 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.