Jump to content

alysson122010

Members
  • Content count

    420
  • Joined

  • Last visited

Community Reputation

2 Comum

About alysson122010

Informações Pessoais

  • Sexo
    Masculino

Recent Profile Visitors

1699 profile views
  1. alysson122010

    Jcrop png erro

    Galera estou com um sistema de jcrop que quando eu coloco imagem jpg e jpeg ele funciona de boa porem quando coloco png a imagem fica toda preta e salva preta. PHP que salva <?php /********************************************************************* Purpose : update image. Parameters : null Returns : integer ***********************************************************************/ $post = isset($_POST) ? $_POST: array(); //print_R($post);die; switch($post['action']) { case 'save' : saveAvatarTmp(); break; default: changeAvatar(); } function changeAvatar() { $post = isset($_POST) ? $_POST: array(); $max_width = "500"; $userId = isset($post['hdn-profile-id']) ? intval($post['hdn-profile-id']) : 0; $path = 'images/tmp'; $valid_formats = array("jpg", "png", "gif", "bmp","jpeg"); $name = $_FILES['photoimg']['name']; $size = $_FILES['photoimg']['size']; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { if($size<(1024*1024)) // Image size max 1 MB { $actual_image_name = 'avatar' .'_'.$userId .'.'.$ext; $filePath = $path .'/'.$actual_image_name; $tmp = $_FILES['photoimg']['tmp_name']; if(move_uploaded_file($tmp, $filePath)) { $width = getWidth($filePath); $height = getHeight($filePath); //Scale the image if it is greater than the width set above if ($width > $max_width){ $scale = $max_width/$width; $uploaded = resizeImage($filePath,$width,$height,$scale); }else{ $scale = 1; $uploaded = resizeImage($filePath,$width,$height,$scale); } /*$res = saveAvatar(array( 'userId' => isset($userId) ? intval($userId) : 0, 'avatar' => isset($actual_image_name) ? $actual_image_name : '', ));*/ //mysql_query("UPDATE users SET profile_image='$actual_image_name' WHERE uid='$session_id'"); echo "<img id='photo' file-name='".$actual_image_name."' class='' src='".$filePath.'?'.time()."' class='preview'/>"; } else echo "failed"; } else echo "Image file size max 1 MB"; } else echo "Invalid file format.."; } else echo "Please select image..!"; exit; } /********************************************************************* Purpose : update image. Parameters : null Returns : integer ***********************************************************************/ function saveAvatarTmp() { $post = isset($_POST) ? $_POST: array(); $userId = isset($post['id']) ? intval($post['id']) : 0; $path ='\\images\uploads\tmp'; $t_width = 300; // Maximum thumbnail width $t_height = 300; // Maximum thumbnail height if(isset($_POST['t']) and $_POST['t'] == "ajax") { extract($_POST); //$img = get_user_meta($userId, 'user_avatar', true); $imagePath = 'images/tmp/'.$_POST['image_name']; $ratio = ($t_width/$w1); $nw = ceil($w1 * $ratio); $nh = ceil($h1 * $ratio); $nimg = imagecreatetruecolor($nw,$nh); $im_src = imagecreatefromjpeg($imagePath); imagecopyresampled($nimg,$im_src,0,0,$x1,$y1,$nw,$nh,$w1,$h1); imagejpeg($nimg,$imagePath,90); } echo $imagePath.'?'.time();; exit(0); } /********************************************************************* Purpose : resize image. Parameters : null Returns : image ***********************************************************************/ function resizeImage($image,$width,$height,$scale) { $newImageWidth = ceil($width * $scale); $newImageHeight = ceil($height * $scale); $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight); $source = imagecreatefromjpeg($image); imagecopyresampled($newImage,$source,0,0,0,0,$newImageWidth,$newImageHeight,$width,$height); imagejpeg($newImage,$image,90); chmod($image, 0777); return $image; } /********************************************************************* Purpose : get image height. Parameters : null Returns : height ***********************************************************************/ function getHeight($image) { $sizes = getimagesize($image); $height = $sizes[1]; return $height; } /********************************************************************* Purpose : get image width. Parameters : null Returns : width ***********************************************************************/ function getWidth($image) { $sizes = getimagesize($image); $width = $sizes[0]; return $width; } ?> Jquery <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('#change-pic').on('click', function(e){ jQuery('#changePic').show(); jQuery('#change-pic').hide(); }); jQuery('#photoimg').on('change', function() { jQuery("#preview-avatar-profile").html(''); jQuery("#preview-avatar-profile").html('Uploading....'); jQuery("#cropimage").ajaxForm( { target: '#preview-avatar-profile', success: function() { jQuery('img#photo').imgAreaSelect({ aspectRatio: '1:1', onSelectEnd: getSizes, }); jQuery('#image_name').val(jQuery('#photo').attr('file-name')); } }).submit(); }); jQuery('#btn-crop').on('click', function(e){ e.preventDefault(); params = { targetUrl: 'profile.php?action=save', action: 'save', x_axis: jQuery('#hdn-x1-axis').val(), y_axis : jQuery('#hdn-y1-axis').val(), x2_axis: jQuery('#hdn-x2-axis').val(), y2_axis : jQuery('#hdn-y2-axis').val(), thumb_width : jQuery('#hdn-thumb-width').val(), thumb_height:jQuery('#hdn-thumb-height').val() }; saveCropImage(params); }); function getSizes(img, obj) { var x_axis = obj.x1; var x2_axis = obj.x2; var y_axis = obj.y1; var y2_axis = obj.y2; var thumb_width = obj.width; var thumb_height = obj.height; if(thumb_width > 0) { jQuery('#hdn-x1-axis').val(x_axis); jQuery('#hdn-y1-axis').val(y_axis); jQuery('#hdn-x2-axis').val(x2_axis); jQuery('#hdn-y2-axis').val(y2_axis); jQuery('#hdn-thumb-width').val(thumb_width); jQuery('#hdn-thumb-height').val(thumb_height); } else alert("Please select portion..!"); } function saveCropImage(params) { jQuery.ajax({ url: params['targetUrl'], cache: false, dataType: "html", data: { action: params['action'], id: jQuery('#hdn-profile-id').val(), t: 'ajax', w1:params['thumb_width'], x1:params['x_axis'], h1:params['thumb_height'], y1:params['y_axis'], x2:params['x2_axis'], y2:params['y2_axis'], image_name :jQuery('#image_name').val() }, type: 'Post', // async:false, success: function (response) { jQuery('#changePic').hide(); jQuery('#change-pic').show(); jQuery(".imgareaselect-border1,.imgareaselect-border2,.imgareaselect-border3,.imgareaselect-border4,.imgareaselect-border2,.imgareaselect-outer").css('display', 'none'); jQuery("#avatar-edit-img").attr('src', response); jQuery("#preview-avatar-profile").html(''); jQuery("#photoimg").val(''); }, error: function (xhr, ajaxOptions, thrownError) { alert('status Code:' + xhr.status + 'Error Message :' + thrownError); } }); } }); </script>
  2. alysson122010

    So motrar como pago quando todos que tiver datas vencidas tiver status 1

    Eu consegui assim: <?php date_default_timezone_set('America/Recife'); $dataatual = date('Y-m-d'); $pag = (isset($_GET['pag'])) ? strip_tags((int)$_GET['pag']) : '1'; $maximo = '10'; $inicio = ($pag * $maximo) - $maximo; $carnes = mysqli_query($conn, "SELECT * FROM carnes WHERE vencimento < '$dataatual' AND status = '1' GROUP BY id_associado DESC LIMIT $inicio, $maximo"); while($rowcarne = mysqli_fetch_assoc($carnes)){ ?> <?php $id = $rowcarne['id_associado']; $sql = mysqli_query($conn, "SELECT * FROM carnes WHERE id_associado = '$id' AND vencimento < '$dataatual' AND status = '0'"); $resultado = mysqli_num_rows($sql); ?> <?php if($resultado > 0){}else{?> <?php $id_s = $rowcarne['id_associado']; $clientes = mysqli_query($conn, "SELECT * FROM associado WHERE idassociado = '$id_s'"); while($row_s = mysqli_fetch_assoc($clientes)){ ?> <tr class="danger"> <td> <?php echo $row_s['idassociado'];?> </td> <td><?php echo $row_s['nome'];?></td> <td><?php echo $row_s['cpf'];?></td> <td align="right"><a href="?acao=alterarassociado&id=<?php echo $row_s['idassociado'];?>&idendereco=<?php echo $row_s['endereco_idendereco'];?>" class="btn btn-primary">Ver</a></td> </tr> <?php }?> <?php }?> <?php } ?> .
  3. Galera como faço para listar so quando todos que tiverem datas vencidas tiver com status 1 $carnes = mysqli_query($conn, "SELECT * FROM carnes WHERE vencimento < '$dataatual' AND status = '1' GROUP BY id_associado DESC LIMIT $inicio, $maximo"); porque tipo se eu coloco assim se tiver so um com data vencida status 1 ele ja mostra com pago e preciso que mostre quando todos tiverem com status 1
  4. alysson122010

    Como Mostrar O dia de inicio e fim de cada semana do mes atual

    Vlw cara deu para eu me virar aqui. obrigado mesmo!
  5. Gostaria de saber de forma autimatica sem eu ta colocando o mes toda vez quero so colocar o codigo date('m/Y') e de forma automatica o php mostrar o inicio da semana atual do mes e o fim dela .
  6. alysson122010

    Como da um echo num input com javascripts

    Show vlw mesmo
  7. Galera tenho esse codigo e gostaria que as impressao das latitudo e longitudo aparecesse em dois inputs diferentes para depois eu manda para um banco de dados com um insert. meu codigo: <p id="demo"></p> <body onload="getLocation()"> <script> var x=document.getElementById("demo"); function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else{x.innerHTML="O seu navegador não suporta Geolocalização.";} } function showPosition(position) { x.innerHTML="Latitude: " + position.coords.latitude + "<br>Longitude: " + position.coords.longitude; } </script> </body>
  8. alysson122010

    Passando parâmetros pela URL

    Simples você passar pela url um exemplo: teste.php?ip=127.0.0.1&url=https://siteinicial.com/post-teste Para recuperar você coloca na pagina de recuperação assim: <?php echo $_GET['ip'];?> <?php echo $_GET['url'];?>
  9. alysson122010

    Como colocar Column bootstrap

    Show me ajudou muito e consegui fazer. So to com mais uma duvida. E se quando tiver na versao mobile eu quiser que as postagens apareça primeiro que as duas colunas como eu faço?
  10. alysson122010

    Como colocar Column bootstrap

    Galera gostaria de transformar o template desse meu web site de uma so Sidebar Widgets Column para duas tipo ficaria postagem no meio das duas Sidebar Widgets. Como posso fazer isso? Site que quero fazer isso: https://linkatorrents.net/
  11. alysson122010

    Botão de status

    Eu conseguir fazer. Pesquisei muito: Index.php <?php include('config.php');?> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <?php $list = mysqli_query($conn, "SELECT * FROM botao"); while($row = mysqli_fetch_assoc($list)){ ?> <form id="form<?php echo $row['id'];?>" name="form<?php echo $row['id'];?>" method="post" action=""> <?php echo $row['nome'];?> - <input name="id" type="hidden" id="id" value="<?php echo $row['id'];?>"/> <input type="submit" id="button<?php echo $row['id'];?>" value="<?php echo $row['status'];?>" /> </form> <script> /*Botao*/ /*Enviar dados*/ $(document).ready(function(){ $("#button<?php echo $row['id'];?>").click(function(e){ jQuery(document).ready(function(){ if(document.getElementById("button<?php echo $row['id'];?>").value == "Ativo"){ document.getElementById("button<?php echo $row['id'];?>").value = "Inativo"; }else{ document.getElementById("button<?php echo $row['id'];?>").value = "Ativo"; } }); }); jQuery('#form<?php echo $row['id'];?>').submit(function(){ var dados = jQuery( this ).serialize(); jQuery.ajax({ type: "POST", url: "processa.php", data: dados, success: function( data ) { } }); return false; }); }); </script> <?php }?> processa.php <?php include('config.php'); $id = $_POST['id']; $list = mysqli_query($conn, "SELECT * FROM botao WHERE id = '$id'"); while($row = mysqli_fetch_assoc($list)){ if($row['status']=='Ativo'){ $update = mysqli_query($conn, "UPDATE botao SET status = 'Inativo' WHERE id = '$id'"); }else{ $update = mysqli_query($conn, "UPDATE botao SET status = 'Ativo' WHERE id = '$id'"); } } ?> Config.php <?php error_reporting(0); ini_set("display_errors", 0 ); $servidor = "localhost"; $usuario = "root"; $senha = ""; $dbname = "teste"; //Criar a conexao $conn = mysqli_connect($servidor, $usuario, $senha, $dbname); ?> Tabela sql -- Estrutura da tabela `botao` -- CREATE TABLE `botao` ( `id` int(11) NOT NULL, `nome` text NOT NULL, `status` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Extraindo dados da tabela `botao` -- INSERT INTO `botao` (`id`, `nome`, `status`) VALUES (1, 'Jose', 'Ativo'), (2, 'Lucas', 'Ativo'); Agora eu gostaria de saber como posso fazer para o botao ficar verde quando tiver ativado e vermelho quando tiver inativo?
  12. alysson122010

    Botão de status

    Gostei da sua ideia deu para eu entender bem. Porem o codigo aqui nao funfo eu clico no botao nada acontece. Oque sera que estou fazendo de errado?
  13. alysson122010

    Botão de status

    Gostaria de saber como fazer um botão de status. Tipo ta la ativo ai quando eu clicar nesse botão ele mude e fique desativado e se eu clicar novamente fique ativado. Sem da refresh na pagina e esse botao envie para meu banco de dados e altere o status na tabela com o id do post. Como eu faço isso nao tenho ideia.
  14. Como faço para no meu web view mostrar so o link do meu site oq naofor do meu site abrir fora da web view. Ja tentei varios tutorias que ta na net nenhum funciona. Meu codigo da webview: mWebView.setBackgroundColor( Color.parseColor("#1e2128")); mWebView.setWebViewClient(new Browser_home()); mWebView.setWebChromeClient(new MyChrome()); WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setAllowFileAccess(true); webSettings.setAppCacheEnabled(true); private void loadWebsite() { mWebView.loadUrl("https://www.baixarfilmetorrent.info/appyoufilmesnovo"); mWebView.setWebViewClient(new WebViewClient () { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { mWebView.loadUrl("file:///android_asset/erro.html"); } }); mInterstitialAd.show (); }
  15. alysson122010

    Escolher oq vai abrir dentro da webview

    Olá galera, eu estou com um problema de abrir os links fora da webview. Eu preciso que todos os links que nao seja o meu que esta rodando na webview abre fora dela pois meus anuncios tem que abrir fora. Exemplo oq for meu link abre na webview, oq nao fora abre fora achei esse codigo na ne porem da erro no meu codigo: Codigo da net: https://pt.stackoverflow.com/questions/256177/questão-com-webview-abrir-mais-de-um-link-fora-do-app?rq=1 Meu codigo: package com.example.cubomaster; import android.content.Context; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.WindowManager; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.FrameLayout; public class MainActivity extends AppCompatActivity { WebView mWebView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mWebView = (WebView) findViewById(R.id.webView); mWebView.setBackgroundColor(Color.parseColor("#1e2128")); mWebView.setWebViewClient(new Browser_home()); mWebView.setWebChromeClient(new MyChrome()); WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setAllowFileAccess(true); webSettings.setAppCacheEnabled(true); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); if(savedInstanceState==null){ mWebView.post(new Runnable() { @Override public void run() { loadWebsite(); } }); } } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); } @Override protected void onSaveInstanceState(Bundle outState ) { super.onSaveInstanceState(outState); mWebView.saveState(outState); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); mWebView.restoreState(savedInstanceState); } private void loadWebsite() { mWebView.loadUrl("file:///android_asset/iniciar.html"); mWebView.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { mWebView.loadUrl("file:///android_asset/erro.html"); } }); } class Browser_home extends WebViewClient { Browser_home() { } @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); } @Override public void onPageFinished(WebView view, String url) { setTitle(view.getTitle()); super.onPageFinished(view, url); } } private class MyChrome extends WebChromeClient { private View mCustomView; private WebChromeClient.CustomViewCallback mCustomViewCallback; protected FrameLayout mFullscreenContainer; private int mOriginalOrientation; private int mOriginalSystemUiVisibility; MyChrome() {} public Bitmap getDefaultVideoPoster() { if (mCustomView == null) { return null; } return BitmapFactory.decodeResource(getApplicationContext().getResources(), 2130837573); } public void onHideCustomView() { ((FrameLayout)getWindow().getDecorView()).removeView(this.mCustomView); this.mCustomView = null; getWindow().getDecorView().setSystemUiVisibility(this.mOriginalSystemUiVisibility); setRequestedOrientation(this.mOriginalOrientation); this.mCustomViewCallback.onCustomViewHidden(); this.mCustomViewCallback = null; } public void onShowCustomView(View paramView, WebChromeClient.CustomViewCallback paramCustomViewCallback) { if (this.mCustomView != null) { onHideCustomView(); return; } this.mCustomView = paramView; this.mOriginalSystemUiVisibility = getWindow().getDecorView().getSystemUiVisibility(); this.mOriginalOrientation = getRequestedOrientation(); this.mCustomViewCallback = paramCustomViewCallback; ((FrameLayout)getWindow().getDecorView()).addView(this.mCustomView, new FrameLayout.LayoutParams(-1, -1)); getWindow().getDecorView().setSystemUiVisibility(3846); } } }
×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.