Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2011
    Posts
    75
    Thanks
    9
    Thanked 2 Times in 2 Posts

    Unhappy delete image javascript problem

    hello all

    I'm trying to get a delete image in to this code but I failed so far
    can anyone help please
    Many Thanks

    this is the code

    Code:
    <script type="text/javascript" src="includes/js/jquery-1.3.2.js" ></script>
    <script type="text/javascript" src="includes/js/ajaxupload.3.5.js" ></script>
    <script language="javascript" type="text/javascript">
    $(function()
    {
    	var btnUpload=$('#upload');
    	var status=$('#status');
    	new AjaxUpload(btnUpload, {
    	action: 'includes/pages/upload-file.php',
    	name: 'uploadfile',
    	onSubmit: function(file, ext)
    	{
    	 if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){ 
         // extension is not allowed 
    	status.text('Only JPG, PNG or GIF files are allowed');
    	return false;
    	}status.text('Uploading...');
    	},
    	
    	onComplete: function(file, response)
    	{
    		//On completion clear the status
    		status.text('');
    		//Add uploaded file to list
    		var sp=response.split('*');
    		
    		var bb=sp[0].substr(0,7)
    		var idd=sp[0].replace('success',' ');
    		var idb =idd.replace(/^\s*|\s*$/g,'');
    		if(bb==="success")
    		{
    			$('<span></span>').appendTo('#files').html('<img src="'+sp[1]+'" alt="" width="120" height="120" style="margin:5px;" />').addClass('success');
    		}
    		else
    		{
    			$('<span></span>').appendTo('#files').text(file).addClass('error');
    		}
    	}});
    });
    			function(i){
    					gallery.data[i]={
    						title:'Deleted',
    						slideUrl:'[url for a picture that says photo deleted]',
    						caption:'Deleted',
    						hash:i,
    						downloadlink:'',
    						width:500,
    						height:500
    					};
    					//Loop over the thumbnails and replace the original thumbnail with the one for a
    					this.$thumbsContainer.find('ul.thumbs > li').each(function(j) {
    						if (j == i){
    							var $li = $(this);
    							var $aThumb = $li.find('a.thumb');
    							var $img=$aThumb.find('img');
    							$img.remove();
    							$aThumb.append('<img src="cross.png">');
    						}
    					});
    					
    			},
    </script>
    
    <hr />
    <?
    $epuid = $_GET["id"];
    $email = $_SESSION['email'];
    $groupname = hex2str($_GET["id"]); 
    $idalb = hex2str($_GET["album"]); 
    $result = mysql_query("SELECT * FROM albums WHERE ID=".$idalb);
    //$idimg = mysql_result($result,0,"ID");
    $resultimg = mysql_query("SELECT * FROM images WHERE albumID =".$idalb);
    //$text = hex2str($_GET['content']);
    $show = mysql_result($result,0,"albshow");
    $name = mysql_result($result,0,"name");
    
    ?>
    <form method="post" action="?id=<?=$epuid;?>&album=<?=$_GET['album'];?>&action=done<? if(isset($_GET['own'])) {echo '&own=owner';}?>">
    
      <input type="hidden" name="groupname" value="<?php echo $groupname ?>" />
      <input type="hidden" name="idalbum" value="<?php echo $idalb ?>" />
    <strong>Album Name</strong><span class="style1">*</span>: <br />
        <input type="text" name="albumname" size="35" value="<? echo $name  ?>" /><br /><br />
    <strong>Album Photos</strong><span>*</span>: <br />
    <div id="upload" ><span>Upload a Image <img src="http://www.zunkies.com/images/but.png"><span></div><span id="status"></span>
        <table><tr><td id="files"><?  while($row=mysql_fetch_array($resultimg))
    	{
    		echo "<img src='".$row['img']."' width='120' height='120' style='margin:5px;'>";
    		}
    		if(isset($_SESSION['session_temp']))
    	{
    	$resultimg = mysql_query("SELECT * FROM images WHERE albumID =".$_SESSION['session_temp']);
    	while($row=mysql_fetch_array($resultimg))
    	{
    		echo "<img src='".$row['img']."' width='120' height='120' style='margin:5px;'>";
    		}
    	}
    	?></td></tr></table>
    	<br />
        <br />
       <strong>Show Ablum To This Group</strong><input type="checkbox" name="show" <? if($show=='yes') {echo 'checked';} else {}?> />
        <br />
        <br />
        <input type="submit"  name="add_item" value="Change this Album!" />
      <br />
      <br />
      <span>*</span> = required  </p>
    </p>
    </form>
    Many Thanks For Replies
    WhatNot

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,398
    Thanks
    12
    Thanked 570 Times in 563 Posts
    You're serious about jQuery 1.3.2? This version of jQuery is more than 4 years old ... we have seen almost 7 major releases and maybe three times as many minor releases since then.

    Did you try to use a more recent version of jQuery?

  • #3
    New Coder
    Join Date
    Feb 2011
    Posts
    75
    Thanks
    9
    Thanked 2 Times in 2 Posts
    the reason I have not updated is because the 2.0 does not support ie 6,7,8
    all tho I see a 1.9 I update to that

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,677
    Thanks
    6
    Thanked 1,008 Times in 981 Posts
    What is this function doing there?
    PHP Code:
    function(i){
        
    gallery.data[i]={
            
    title:'Deleted',
            
    slideUrl:'[url for a picture that says photo deleted]',
            
    caption:'Deleted',
            
    hash:i,
            
    downloadlink:'',
            
    width:500,
            
    height:500
        
    };
        
    //Loop over the thumbnails and replace the original thumbnail with the one for a
        
    this.$thumbsContainer.find('ul.thumbs > li').each(function(j) {
            if (
    == i){
                var 
    $li = $(this);
                var 
    $aThumb $li.find('a.thumb');
                var 
    $img=$aThumb.find('img');
                
    $img.remove();
                
    $aThumb.append('<img src="cross.png">');
            }
        });        
    }, 
    There is no function name that can be used in any way and there is a stray comma at the end. And the code within this function doesn’t apply to anything in the HTML. In fact, this function is totally random there.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •