Jump to content

ukscotth

Members
  • Posts

    195
  • Joined

  • Last visited

Everything posted by ukscotth

  1. thanks for your replies. Il have a read of that site
  2. Hi, I run a site that contains images I dont want people to steal. I know its impossible to stop them but I want to make it as difficult for them as possible. I have seen people posting my sites images url's on various other sites and I thought I could stop them by changing the image filenames every now and again. Anyone have any ideas to how I could do this ? maybe using a cron job or something similar. Also does anyone know any other methods I could use to help stop people stealing my images ? Thanks in advance. Scott
  3. Thanks for a fast response premiso il give it a try now
  4. Hi, I have a database table which is full of paths to pictures e.g /pictures/12313213.jpg /pictures/35423454.jpg Id like to change all the data to a longer path, basically i need to add some text to the beginning of every entry so the table contains things like this instead : http://www.blahblah.com/pictures/12313213.jpg http://www.blahblah.com/pictures/35423454.jpg Can someone show me how plzzzzz ? thanks very much. Scott
  5. solved. It was due to having one of the fields set as a primary index. oops.
  6. Hi, Im trying to copy all data from one table into another while changing a few things on the fly. Basically I have a social networking site and i have a table which stores whos friends with who but I need to store the information in a different way, hence the new table. The problem is with the code im using below it only copies one record for each member e.g if fred has 50 friends its only copying the data for 1 of them. Hope that makes sens and hope someone can help, heres the code : <?php include("include/config.inc.php"); $users = mysql_query("SELECT * FROM joovili_buddies"); while ($got_users = mysql_fetch_array($users)){ $fid = mysql_query("SELECT * FROM joovili_users WHERE username = '".$got_users['buddy_username']."' "); if (mysql_num_rows($fid) == 0) {} else { $fid1 = mysql_fetch_array($fid); } $fid2 = mysql_query("SELECT * FROM joovili_users WHERE username = '".$got_users['buddy_buddy']."' "); if (mysql_num_rows($fid2) == 0) {} else { $fid3 = mysql_fetch_array($fid2); } mysql_query("INSERT INTO userlist (`userid`, `relationid`, `friend`) VALUES ('".$fid1['id']."', '".$fid3['id']."', 'yes')"); } ?>
  7. hi patrick. Thanks for your response. I dont need to call them from another page. I simply want to display 5 random images from the database.
  8. Hi, does anyone know how to display multiple blob images and resize them. So far all i can manage to do is show one image using this code : <?php include("include/configvb.inc.php"); header ("Content-type: image/jpeg"); $query = mysql_query("SELECT * FROM picture LIMIT 5"); $row = mysql_fetch_array($query); $logo = $row['filedata']; header('Content-type: image/jpg'); echo $logo; ?> Id like to be able to ddisplay them like this idealy : any help would be most appreciated
  9. just had a play about and if i put this in phpmyadmin it manages to transfer all the posts but how do i put variables into this line of code so i can get the userid etc ? INSERT INTO post (postid, threadid, username, userid, pagetext, allowsmilie, visible) SELECT post_id, post_topic,post_username,30,post_body,1,1 FROM joovili_forum_posts
  10. Hi, Im trying to transfer the data from my old forum to a new one which is different. For some reason when i transfer the posts it misses random posts. This is the code im using, can anyone see a problem with it ? <?php include("include/configvb.inc.php"); $topics = mysql_query("SELECT * FROM joovili_forum_posts WHERE post_board=3"); while ($got_users = mysql_fetch_array($topics)){ $fid = mysql_query("SELECT * FROM joovili_users WHERE username = '".$got_users['post_username']."' LIMIT 1"); if (mysql_num_rows($fid) == 0) { $i ='0'; } else { $fid1 = mysql_fetch_array($fid); $i = $fid1['id']; } $string = $got_users['post_date']; $timestamp = strtotime($string); mysql_query("INSERT INTO post ( `dateline`, `postid`, `threadid`, `username`, `userid`, `pagetext`, `allowsmilie`, `visible` ) VALUES ( '".$timestamp."', '".$got_users['post_id']."', '".$got_users['post_topic']."', '".$got_users['post_username']."', '".$i."', '".$got_users['post_body']."', '1', '1' )"); } ?> many thanks, scott.
  11. thanks alot keith thats great
  12. thnx peeps, looks like its worked doing it that way
  13. ok thanks very much, il give it a go now
  14. coz im a newbie lol but thanks so all i need to use is that single line yes ?
  15. Hi, Whenever I run this script my server freaks out and I end up having to reboot it. Any ideas why ? there are 19000 pictures but ive run similar scripts and had no problems <?php include("include/configvb.inc.php"); $pics = mysql_query("SELECT * FROM picture"); while ($got_pics = mysql_fetch_array($pics)){ mysql_query("INSERT INTO albumpicture (`albumid`,`pictureid`) VALUES ('".$got_pics['userid']."','".$got_pics['pictureid']."')"); } ?>
  16. thnx, both of those look pretty complicated and not sure if u can use them for a folder full of pictures is there not a simple modification i can make to the script i posted ? thnx Scott
  17. Hi, I have this script for creating thumbnails which works fine but can someone please show me how to modify it so instead of it changeing the width every time it changes either the width or height, whichever one is bigger. So if i set it to say 150, neither the height or width will ever be bigger than 150. Also so it doesnt increase the size if both the width and height are already lower than 150. Hope that makes sense and i hope someone can help <?php function makeThumbs( $pathToImages, $pathToThumbs, $thumbWidth ) { $dir = opendir($pathToImages); while (false !== ($fname = readdir($dir))) { $info = pathinfo($pathToImages . $fname); if (strtolower($info['extension']) == 'jpg') { echo "Creating thumbnail for $fname <br />"; $img = imagecreatefromjpeg($pathToImages . $fname); $width = imagesx($img); $height = imagesy($img); $new_width = $thumbWidth; $new_height = floor($height * ($thumbWidth / $width)); $tmp_img = imagecreatetruecolor($new_width, $new_height); imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height ); imagejpeg( $tmp_img, "{$pathToThumbs}{$fname}"); } } closedir($dir); } makeThumbs("pictures/","thumbs/",150); ?>
  18. thanks aschk. Job already done. Took about half hour but as its just a one off job its fine. Thanks again for your quick responses. Scott
  19. Ok thats great, thanks very much for your help. Its well appreciated
  20. Thanks Keith, It came up with a duplicate entry error, looks like its working now ive emptied the table. Theres over 10,000 pictures, will it be able to cope do you think i will i have to run it in parts ?
  21. Hi, Im trying to transfer a folder full of pictures to a new database as im changing the software my site runs off and im having a bit of trouble with the coding, can anyone see anything wrong with this ? im getting this error 'Couldn't insert image' <?php include("include/configvb.inc.php"); $pics = mysql_query("SELECT * FROM joovili_pictures"); while ($got_pics = mysql_fetch_array($pics)){ $fid = mysql_query("SELECT * FROM joovili_users WHERE username = '".$got_pics['picture_username']."' LIMIT 1"); if (mysql_num_rows($fid) == 0) {} else { $fid1 = mysql_fetch_array($fid); } $fh = fopen($got_pics['picture_path'], "r"); list($width, $height, $type, $attr) = getimagesize($got_pics['picture_path']); $data = addslashes(fread($fh, filesize($got_pics['picture_path']))); fclose($fh); $id = $got_pics['picture_id']; $uid = $fid1['id']; $SQL = " INSERT INTO picture(pictureid, userid, extension, filedata, width, height, state, caption) VALUES('$id','$uid','jpg','$data','$width','$height','visible','oldpic')"; $RESULT = mysql_query($SQL) or die("Couldn't insert image"); } ?>
  22. Thanks Ryan. So I should convert all the images to thumbnails first and then use the same way of coverting them to binary strings as before and then insert them into the database ?
  23. worked out how to get the dimensions, just stuck on the thumbnail part
×
×
  • 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.