Jump to content

Craig Hopson

Members
  • Posts

    212
  • Joined

  • Last visited

Posts posted by Craig Hopson

  1. hi guys well the question is in the topic i found this http://strd6.com/2011/09/html5-javascript-pasting-image-data-in-chrome/ and this http://www.pasteshack.net/ proving it can be done!! The reason i want this is because i want users of my website to be able to upload photos from there mobiles and file cant be uploaded via http on mobile device (i read somewhere)if there is a better way or and example code for doing this then please help Thanks.

  2. hi guys how do i supply website information?(see pic) Untitled.png i am guessing its done with meta tags hence the topic title but i have googled but with no luck

  3. hi i have this function to encrypt data in cookies is this the correct way?

    <?phpdefine('SALT', 'hyDap4XQ6TDu');function encrypt($text){    return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, SALT, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));}function decrypt($text){    return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, SALT, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));}?>

  4. hi i'm stuck again i want a simple image slider but the problem is this

    var finalslide=''leftrightslide[0]='<img src="dynamicbook1.gif" border=1></a>'leftrightslide[1]='<img src="dynamicbook2.gif" border=1></a>'leftrightslide[2]='<img src="dynamicbook3.gif" border=1></a>'leftrightslide[3]='<img src="dynamicbook4.gif" border=1></a>'leftrightslide[4]='<img src="dynamicbook5.gif" border=1></a>'

    as you can see i need to tell it what images to display problem is my images come from this

    $result = mysql_query("SELECT * FROM files ORDER BY RAND() LIMIT 20");while($row = mysql_fetch_array($result))  {$img = 'uploads/'.$row['album'].'/'.$row['filename'];echo '<span style="padding:10px;"><img src="'.$img.'" width="50px" height="50px" style="border:1px solid black;"/></span>';}

    so how can i integrate them?

  5. hi I use sessions now and then i get this error

    Warning: session_start() [function.session-start]: open(/tmp/sess_53ff81c3601f65a11a9026a079284d89, O_RDWR) failed: Permission denied (13) in /home/chsitesc/public_html/test/index.php on line 2Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/chsitesc/public_html/test/index.php:2) in /home/chsitesc/public_html/test/index.php on line 2Warning: Cannot modify header information - headers already sent by (output started at /home/chsitesc/public_html/test/index.php:2) in /home/chsitesc/public_html/test/config.php on line 14
    once i get this error the only way to get rid is to delete a cookie called PHPSESSID with value of = 53ff81c3601f65a11a9026a079284d89. what is this error why do i get (not often)?
  6. SOLVED like this

    <script type="text/javascript">  $('#test').addClass('js');$(function() {  var timer = setInterval( showDiv, 1000);  var counter = 0;  function showDiv() {    if (counter ==0) { counter++; return; }    $('#div1, #div2, #div3, #div4, #div5, #div6, #div7')	  .stop()	 	  .filter( function() { return this.id.match('div' + counter); })  	  .show('fast');	 counter == 10? counter = 0 : counter++;	 if(counter == 10){		 $('#div1, #div2, #div3, #div4, #div5, #div6, #div7').hide('slow');	 counter = 0;	 } 	  }});</script>

  7. hi guys i'm using this

    <script type="text/javascript">  $('#test').addClass('js');$(function() {  var timer = setInterval( showDiv, 2000);  var counter = 0;  function showDiv() {	if (counter ==0) { counter++; return; }	$('#div1, #div2, #div3, #div4, #div5, #div6, #div7')	  .stop()		  .filter( function() { return this.id.match('div' + counter); })  	  .show('fast');	counter == 7? counter = 0 : counter++;	    }});</script>

    to show #div1, #div2 ect One after another Question:- How do i make it hide them all 20 seconds after the last one shows and restart? Thanks guys

  8. My page is a simple gallery users upload pictures mainly from mobile devices, if user takes photo and phone is sidewise picture is sidewise in gallery so need a option to rotate the image also saving image so next time they look at the gallery it's correct

  9. hi guys i have a few problems when i use this function to rotate image

    function rotate($img,$rot){global $id;  //get the detail of the image  $imageinfo=getimagesize($img);  switch($imageinfo['mime'])  {   //create the image according to the content type   case "image/jpg":   case "image/jpeg":   case "image/pjpeg": //for IE		$src_img=imagecreatefromjpeg("$img");				break;	case "image/gif":		$src_img = imagecreatefromgif("$img");				break;	case "image/png":		case "image/x-png": //for IE		$src_img = imagecreatefrompng("$img");				break;  }  //rotate the image according to the spcified degree  $src_img = imagerotate($src_img, $rot, 0);  //output the image to a file  imagejpeg ($src_img,$img);}rotate($_GET['img'],$_GET['rot'])

    PROBLEMS1.......When using browsers cache images so browser needs refreshing after use(I have used httaccess to stop cache'ing)2.......Calling the function. At the moment the function is in a file and i use the GET method from a href (<a href="rotate.php?img='.$Image.'&rot=90">Rotate</a> which flashes a white blank page before coming back to the gallary3.......Could i use jQuery to rotate (It has to save the image after rotation)4.......IS THERE A BETTER WAY TO DO THIS?????? Thanks guys

  10. hi guys i cant get this working am i missing something simple?

    <script src="js/jquery-1.7.2.min.js"></script><script type="text/javascript">$('.show-element', '.Item').hover(function() {	var container = $(this).attr("id").replace('show_', 'info_');	$('#' + container).show();}, function() {	var container = $(this).attr("id").replace('show_', 'info_');	$('#' + container).fadeOut(200);});</script><style>.hidden{	display: none;}</style><div class='Item'>	<div class='show-element' id='show_1'>Show</div>	<div id="info_1" class="hidden">some stuff</div>	<div class='show-element' id='show_2'>Show</div>	<div id="info_2" class="hidden">some stuff</div></div>

    (does not show on hover)

  11. function converttojpg($originalimg){$filetype = @end(explode(".", $originalimg));if (strtolower($filetype) == 'jpg' or strtolower($filetype) == 'jpeg')	{	$srcImg = imagecreatefromjpeg($originalimg);	imagejpeg($srcImg,$originalimg,75);	imagedestroy($srcImg);  $thumb_img = imagecreatefromjpeg($originalimg);  $origw=imagesx($thumb_img);$origh=imagesy($thumb_img);$new_w = 150;$diff=$origw/$new_w;$new_h=$new_w;$dst_img = imagecreate($new_w,$new_h);imagecopyresampled($dst_img,$thumb_img,0,0,0,0,$new_w,$new_h,imagesx($thumb_img),imagesy($thumb_img));$ONLYname = str_replace('uploads/'.$_COOKIE['id'].'/',"",$originalimg);imagejpeg($dst_img, 'uploads/'.$_COOKIE['id'].'/thumbnail/'.$ONLYname,100);	}  if (strtolower($filetype) == 'png')	{	$srcImg = imagecreatefrompng($originalimg);	imagejpeg($srcImg,$originalimg,100);	imagedestroy($srcImg);  	$NewName = str_replace(".png",".jpg",$originalimg);	rename($originalimg,$NewName);  $thumb_img = imagecreatefromjpeg($NewName);  $origw=imagesx($thumb_img);$origh=imagesy($thumb_img);$new_w = 150;$diff=$origw/$new_w;$new_h=$new_w;$dst_img = imagecreate($new_w,$new_h);imagecopyresampled($dst_img,$thumb_img,0,0,0,0,$new_w,$new_h,imagesx($thumb_img),imagesy($thumb_img));$ONLYname = str_replace('uploads/'.$_COOKIE['id'].'/',"",$NewName);imagejpeg($dst_img, 'uploads/'.$_COOKIE['id'].'/thumbnail/'.$ONLYname,100);	}  if (strtolower($filetype) == 'gif')	{	$srcImg = imagecreatefromgif($originalimg);	imagejpeg($srcImg,$originalimg,100);	imagedestroy($srcImg);	$NewName = str_replace(".gif",".jpg",$originalimg);	rename($originalimg,$NewName);$thumb_img = imagecreatefromjpeg($NewName);  $origw=imagesx($thumb_img);$origh=imagesy($thumb_img);$new_w = 150;$diff=$origw/$new_w;$new_h=$new_w;$dst_img = imagecreate($new_w,$new_h);imagecopyresampled($dst_img,$thumb_img,0,0,0,0,$new_w,$new_h,imagesx($thumb_img),imagesy($thumb_img));$ONLYname = str_replace('uploads/'.$_COOKIE['id'].'/',"",$NewName);imagejpeg($dst_img, 'uploads/'.$_COOKIE['id'].'/thumbnail/'.$ONLYname,100);	}  }

    Thanks guys for taking the time to look into this for me

  12. posting the original image with that one would be more helpful. though you should use imagecropresampled() rather than imagecopyresized(). imagecopyresized() deform when it crop which could make image defective.
    i have done this but still the same any other ideas??
×
×
  • Create New...