Jump to content

Recommended Posts

Posted

Ma scuzati de dublu post dar nu pot edita.

Uitati si tot scriptul.

 

<?php
include_once 'includes.php';
include_once 'public.php';
include_once 'includes/getExtension.php';
$valid_formats = array("jpg", "png", "gif", "bmp","jpeg","PNG","JPG","JPEG","GIF","BMP");
if(isset($_POST) && $_SERVER['REQUEST_METHOD'] == "POST") {
      $name = $_FILES['photoimg']['name'];
      $size = $_FILES['photoimg']['size'];
      $imageType=$_POST['imageType'];
      if(strlen($name)) {
      $ext = getExtension($name);
      if(in_array($ext,$valid_formats)) {
      if($size<(1024*$uploadImageSize)) { // Check the image size 
      $actual_image_name = $uid.time().".".$ext; // Change the image ame
      $tmp = $_FILES['photoimg']['tmp_name'];
      include 'includes/compressProfileImage.php';
      $style='';
      $class='';
      $bgSave='';
      if($imageType == 1) {
      /* User Profile Pic */
      $widthArray = array($TimelineProfilePX); /* Image Pixel Size*/
      $prefix='user'; /* Image Prefix */
      foreach($widthArray as $newwidth) {
        // Compres the image using compressProfileImage.php in includes file
        $filename=compressProfileImage($ext,$tmp,$profile_image_path,$actual_image_name,$newwidth,$prefix);
        }
        // Then prefix the image like user_134567.jpg
        $final_image_name=$prefix.'_'.$actual_image_name;
        // Upload an image 
        $newdata=$Mat->Profile_Image_Upload($uid,$final_image_name);
        $style='timelineIMG';
        }
        if($newdata) {
          echo $bgSave.'<img src="'.$base_url.$filename.'"  id="'.$style.'" class="'.$class.'"/>';
        } else {
        echo "Fail upload folder with read access.";
        }
        } else {
            echo "Image file size max 1 MB";
        }
        } else {
        echo "Invalid file format.";}
        } else
            echo "Please select image..!";
          exit;
    }
    
    
?>

 

  • Moderators
Posted

Cat ocupa imaginea mai exact?

PHP Developer - Not available for freelancing right now

Daca ai de gand sa postezi la categoria IPB, nu uita sa citesti regulamentul: Link regulament

  • Moderators
Posted

Adauga inainte de ace-l if un:

echo $uploadImageSize . "<br />" . $size;

Si vezi ce marimi iti da.

PHP Developer - Not available for freelancing right now

Daca ai de gand sa postezi la categoria IPB, nu uita sa citesti regulamentul: Link regulament

  • Moderators
Posted

Eu ma refer sa vezi ce marimi iti returneaza echoul ala.

Poate marimea care iti da nu e un numar, poate da eroare altundeva.

Trebuie sa faci un debug la codu acela si sa vezi ce returneaza fiecare variabila inainte de ifu ala.

PHP Developer - Not available for freelancing right now

Daca ai de gand sa postezi la categoria IPB, nu uita sa citesti regulamentul: Link regulament

Posted (edited)

Pai si unde ar trebui sa.mi returneze marimile? Am pus codul si imi da eroare ca nu e dfininit l.am definit si imi da tot ce imi dadea la inceput...

si cum adica sa fac un debug ca nu pricep ? 

Edited by PAProject
  • Moderators
Posted

Pai codu:

$name = $_FILES['photoimg']['name'];
$size = $_FILES['photoimg']['size'];

Ar trebui sa citeasca de la "formu" de upload odata ce-i dai submit la formular.

Despre debug, ar trebui sa sti daca lucrezi cu PHP sau cu orice limbaj de programare, in cazu lu PHP vezi aici: http://php.net/manual/en/debugger.php

PHP Developer - Not available for freelancing right now

Daca ai de gand sa postezi la categoria IPB, nu uita sa citesti regulamentul: Link regulament

Posted (edited)

Am facut cum mi-ai zis dar nu imi apare nimic !

Nu pot rezolva ma chinui de trei zile ... ma dau batut ...problema e ca nu are nimic din cod-ul de mai sus din alta parte dar nu mai stiu unde am umblat ...

Edited by PAProject

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.