Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/10/2012, 17:22
wayward
(Desactivado)
 
Fecha de Ingreso: enero-2004
Mensajes: 136
Antigüedad: 20 años, 11 meses
Puntos: 0
Respuesta: Image Resize y creat miniaturas ENVIO

Código PHP:
Ver original
  1. <?php
  2. /*
  3. Template Name: Create a Job
  4. */
  5. ?>
  6. <?php
  7.  
  8. if($_REQUEST['backedit']=='')
  9. {
  10.     $_SESSION['ads_information_session'] = array();
  11. }
  12. if(!$current_user->data->ID)
  13. {
  14.     wp_redirect(get_settings('home').($location='/wp-login.php'));
  15.    
  16. }
  17. global $wpdb,$General;
  18. $generalinfo = $General->get_general_settings();
  19.  
  20. $pid = $_REQUEST['pid'];
  21. $data = array();
  22. if($_SESSION['ads_information_session']['post'])
  23. {
  24.     $post_info = $_SESSION['ads_information_session']['post'];
  25.     $data['post_title'] =  $post_info['post_title'];
  26.     $data['description'] =  $post_info['description'];
  27.     $data['post_location'] = $post_info['post_location'];
  28.        
  29.     $data['post_url'] = $post_info['post_url'];
  30.     $data['owner_name'] = $post_info['owner_name'];
  31.     $data['owner_email'] = $post_info['owner_email'];
  32.     $data['owner_phone'] = $post_info['owner_phone'];
  33.     $data['zona'] = $post_info['zona'];
  34.     $data['termid'] = $post_info['termid'];
  35.     $data['main_cat'] = $post_info['termid'];
  36.     $data['post_tags'] = $post_info['post_tags'];
  37.     $data['coupon_code'] = $post_info['coupon_code'];
  38.     $data['feature_prd'] = $post_info['feature_prd'];
  39.     if($_SESSION['ads_information_session']['images'])
  40.     {
  41.         $post_images = implode(',',$_SESSION['ads_information_session']['images']);
  42.     }
  43. }
  44. elseif($pid)
  45. {
  46.     $post_info = $General->get_post_info($pid);
  47.     $data['post_title'] =  $post_info['post_title'];
  48.     $data['description'] =  $post_info['post_content'];
  49.     $catinfoarr = get_the_category($post_info['ID']);
  50.     $isfeature = '';
  51.     for($c=0;$c<count($catinfoarr);$c++)
  52.     {
  53.         if($catinfoarr[$c]->term_id == $generalinfo['feature_catid'])
  54.         {
  55.             $isfeature = 'checked="checked"';
  56.         }else
  57.         {
  58.             $data['termid'] = $catinfoarr[$c]->term_id;
  59.         }
  60.     }
  61.     $isfeature = '';
  62.     for($c=0;$c<count($catinfoarr);$c++)
  63.     {
  64.         if($catinfoarr[$c]->term_id == $generalinfo['feature_catid'])
  65.         {
  66.             $isfeature = 'checked="checked"';
  67.         }else
  68.         {
  69.             $data['main_cat'] = $catinfoarr[$c]->term_id;
  70.         }
  71.     }
  72.     $isfeature = '';
  73.     for($c=0;$c<count($catinfoarr);$c++)
  74.     {
  75.         if($catinfoarr[$c]->term_id == $generalinfo['feature_catid'])
  76.         {
  77.             $isfeature = 'checked="checked"';
  78.         }else
  79.         {
  80.             $data['zona'] = $catinfoarr[$c]->term_id;
  81.         }
  82.     }
  83.     $data['post_location'] = get_post_meta($post_info['ID'], 'post_location', $single = true);
  84.     $data['post_url'] = get_post_meta($post_info['ID'], 'post_url', $single = true);
  85.     $data['owner_name'] = get_post_meta($post_info['ID'], 'owner_name', $single = true);
  86.     $data['owner_email'] = get_post_meta($post_info['ID'], 'owner_email', $single = true);
  87.     $data['owner_phone'] = get_post_meta($post_info['ID'], 'owner_phone', $single = true);
  88.     $post_images = get_post_meta($post_info['ID'], 'post_images', $single = true);
  89.     $tagsarr = get_the_tags($post_info['ID']);
  90.     if($tagsarr)
  91.     {
  92.         $tags = array();
  93.         foreach($tagsarr as $key=>$val)
  94.         {
  95.         $tags[] = $val->name;
  96.         }
  97.         $post_tags = implode(',',$tags);
  98.         $data['post_tags'] = $post_tags;
  99.     }
  100. }
  101. //echo "<pre>";
  102. //print_r($_SESSION['ads_information_session']);
  103.  
  104.  
  105. ?>
  106.  
  107. <div class="upload">
  108.     <input name="fileId" id="fileId" value="" type="hidden">
  109.     <input name="fileTitle" id="fileTitle" value="" type="hidden">
  110.     <input value="1" name="Count" id="Count" type="hidden">
  111.     <input name="images[]" value="" type="file" class="textfield" />
  112.      <div id="file_div"> </div>
  113.    <input type="button" name="AddNew" value="Añadir nueva imagen" class=" addnew" onClick="customClick('file','','','');" />
  114.     </div>
  115.    
  116.    <div style="clear:both;">
  117.      <?php
  118.      if($post_images!='')
  119.      {
  120.         $post_images_arr = explode(',',$post_images);
  121.         for($i=0;$i<count($post_images_arr);$i++)
  122.         {
  123.             ?>
  124.            
  125.            
  126.            <div style="width:50px;   float:left; margin:0 11px 11px 0; " id="img_<?php echo $i;?>" >
  127.            <img src="<?php bloginfo('template_directory'); ?>/thumb.php?src=<?php echo $post_images_arr[$i]; ?>&amp;w=50&amp;h=50&amp;zc=1<?php echo $thumb_url;?>" alt="<?php the_title(); ?>"   />
  128.            <input type="hidden" name="hidden_image[]" value="<?php echo $post_images_arr[$i]; ?>" />
  129.            <a href="javascript:void(0);" onClick="removeImage('<?php echo $post_images_arr[$i]; ?>','img_<?php echo $i;?>');"><?php _e(REMOVE_LINK_TEXT);?></a>
  130.            </div>
  131.  
  132.            
  133.             <?php
  134.         }
  135.      }
  136.      ?>
  137.                    </div>
  138.       </div>
  139.      <input type="hidden" name="type" value="<?php echo $_REQUEST['type'];?>" />
  140.      <?php
  141.     if($_REQUEST['pid'])
  142.     {
  143.         if($isfeature!='')
  144.         {
  145.     ?>
  146.     <input type="hidden" name="feature_prd" value="1" />
  147.     <strong><?php _e(POST_ADS_FEATURE_MSG1);?></strong>
  148.     <?php
  149.         }
  150.     }else
  151.     {
  152.     ?>
  153.         <div class="create_post_row clearfix" style="display:none"> <label> <?php _e(COUPON_CODE_TEXT);?> :  </label>
  154.         <input name="coupon_code" value="<?php echo $data['coupon_code'];?>" type="text" class="textfield" />
  155.         <span class="note"> <?php _e(COUPON_CODE_TEXT_NOTE);?> </span>
  156.        </div>
  157.     <?php        
  158.          if($generalinfo['feature_catid'])
  159.          {
  160.         ?>
  161.         <div class="create_post_row clearfix"> <span class="pay_basic"><?php _e(POST_ADS_FEATURE_MSG2);?> <strong> <?php echo $generalinfo['currencysym'].$generalinfo['ads_price'];?>.</strong></span></div>
  162.          
  163.         <div class="create_post_row clearfix row_spacer">  <span class="featured_ads_price">  <input type="checkbox" <?php echo $isfeature;?> <?php if($data['feature_prd']){ echo 'checked="checked"';}?>  name="feature_prd" value="1" /> <?php _e(POST_ADS_FEATURE_MSG3);?>
  164.         <?php if($isfeature ==''){?>
  165.         <?php _e(POST_ADS_FEATURE_MSG4);?> <strong class="extra_price">  <?php echo $generalinfo['currencysym'].$generalinfo['feature_ads_price'];?> </strong> <?php _e(POST_ADS_FEATURE_MSG5);?>
  166.         <?php }?>  </span>  
  167.         </div>
  168.          
  169.         <?php
  170.          }
  171.      }
  172.      ?>
  173.      <input type="submit" name="submit" value="<?php _e(PREVIEW_BUTTON);?>"  class="normal_button preview" />  
  174. </form>