Jump to content

GleyRejeb

Members
  • Posts

    12
  • Joined

  • Last visited

Posts posted by GleyRejeb

  1. Thanks ^_^ !!  Problem solved.

    chdir('\path\to\your\directory');
    exec("convert $original_image  $new_image.png ");

    Yes, we have to change the Directory as you said ...

    but now i want to convert from  pdf to png ..

    do you have any idea ??

  2. Thank you  first for your reply..

    i tried this using exec function , and was helpful , but the problem is by saving the uploaded img.

    how can make directory by Exec function,.

    exec("convert $original_image  $new_image.png ");

     

  3. Sorry, that's was not heplfull .

    the problem is to upload a tif image and do the conversion and then display the image as jpg image in the Thumnaill. thats all ...

     

  4. On 19.6.2017 at 6:33 PM, justsomeguy said:

    What happens when you run that?

    thank you 4 ur answer ..

    Nothing happened, I wanted to make this in 3 step just when i clik on upload button :

    1-convert
    2-save this in images folder
    3-display on the browser

    
    <?php
    $my_images_arr = scandir("images");
    $img_string = "";
    $image= 'C:/Program Files/Lexmark/Solutions/Apache2/htdocs/test/images';
    
     
    //   $image = new Imagick('cat.tiff');
    //   $image->setimageformat('png');
    //   echo $image;
     
    
    
    
    foreach ($my_images_arr as $image_name) {
        if(
                strlen ($image_name) > 2   &&  strrpos($image_name,'.db') != true   
                
                )
        
            
                      
        {
            $img_string .= '<img src ="images/'.$image_name.'">';
            
     
        }
         
        
      
    }
    
    ?>
    
    
    
    
    
    
    
    
       
    
    
    <!DOCTYPE html>
    <html >
    <head>
        <title> Bilder Galerie </title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
       
      <style type="text/css">
    
         
          div#buttons{
          position:absolute;
          margin-left:-258px;
          
          }
           div#gHolder{
                width: 1348px;
                height: auto;
                margin: 0 auto;
                background-color: #FFA500;
                padding: 10px;
                position:fixed;
           }
           div#theBigImageHolder{
                width: 0px;
                height: 0px;
                background-color: white;
              
                
           }
           div#thumbnailsHolder{
                width: 393px;
                height: 940px;
                background-color: white;
                margin: -8px 14px auto;
                padding: 4px;
                overflow: auto;
                float: none;
           }
               div#Holder{
                 background-color: #FFA500;
                 width: 530px;
                 height: 960px;
                 float: right;
            
           }
    
           div#theBigImageHolder > img{
               
               border: 15px solid #3e2b14;
               width: 900px;
               height: 917px;
               /*margin: 71px 447px auto;*/         
               /*box-shadow: 0px 0px 3px 749px rgba(11, 12, 12, 0.95);*/
                 
               margin-top: -8px;
               margin-left:422px;
               top: 0;
               left: 0;
               right: 0;
               bottom: 0;*/
                 
                
        }
                   
           div#thumbnailsHolder > img{
               width: 90px;
               height: 90px;
               display: block;
               float: left;
               margin: 2px;
               transition: border-radius 0.3s linear 0s;
               overflow: auto;
           }
           div#thumbnailsHolder > img:hover{
               border-radius: 100px;
               cursor:pointer;
    
           }
           
               
          </style>
    
          <script type ="text/javascript">
              function imgFunc() {
                  var bigImage = document.getElementById("BigImage");
                  var thumbnailsHolder = document.getElementById("thumbnailsHolder");
    
             thumbnailsHolder.addEventListener("click",function(event){
                 if (event.target.tagName == "IMG"){
                     bigImage.src = event.target.src;
                 }
                
             },false);
          }
          window.addEventListener("load",imgFunc,false);
    
    
          
    
    
       
          
    
       </script>
    </head>
    
    <body>
     
    
    
         <div id ="gHolder">
           <div id="theBigImageHolder">
              <?php
                  echo '<img src="images/'.$my_images_arr[0].'" id="BigImage">';
               ?> 
           
         
           </div>
           <div id="thumbnailsHolder">
                 
               
                  
                  <?php
                     echo $img_string;  
                   ?>
     
                  
                   
                   
             
           </div>
         </div>  
    
         <div id="Holder">
    <!--        <div id="buttons"> -->
    <!--        <form  action="upload.php" method="post" enctype="multipart/form-data"> -->
    <!--        <p>Bitte eine Datei auswaehlen<br> -->
    <!--        <input type="file" name="image"> <br> -->
    <!--        <input type="submit"  value="Hochladen">   -->
           
           
           
    <!--        </form> -->
    <!--        </div> -->
         
        <center> 
        <br><br> <form action="index.php" method="post" enctype="multipart/form-data">
            Datei auswaehlen:<input type="file" name="image"><br /><br />
            beschreibung:<input type="text" name="desc"><br /><br />
            <input type="submit" name="upload" value="Hochladen">
        </form>
        <hr style ="border:2px solid green;">
        </center>
        <center>
        
        <?php
        
           $im= new Imagick();
        
        if(isset($_POST['upload']))
        {
        	
        	
        	$image_name = $_FILES['image']['name'];
    	    $image_type = $_FILES['image']['type'];
    	    $image_size = $_FILES['image']['size'];
    	    $image_tmp_name= $_FILES['image']['tmp_name'];
    	    $desc = $_POST['desc'];
    	    $im->setimageformat('png');
    // 	    header( "Content-Type: image/png" );
    // 	    echo $im;
    	   
    	    
    	    
               
    
        move_uploaded_file($image_tmp_name,"images/$image_name");
    
            echo "<img src='images/$image_name' width='400' height='250'><br>$desc";
           
            
               
        }
        ?>
        </center>
             </div>  
    
    </body>
    </html>

     

  5. Hi again ,

    i added this code to my script , but i cant move on ..

    can someone help me ??

    <?php
    $imageOrigine = "images/cat.tiff";
     
    $image = new Imagick();           
    $image->pingImage($imageOrigine); 
    $image->readImage($imageOrigine); 
    $image->setImageFormat("jpg");    
    $image->writeImage("temp.jpg");
    
    ?>

     

  6. No i can't, because i want to build this for clients and i work with peaple who use many files from TIFF  , thats why the gd way is to create a php function ...

  7. Hello Everybody,

    How can i convert an image from .tiff to .jpg using php ?

    please , need help !!!

    I've already seen many exples on Stackoverflow but there were not helpful.

    I'am building a bildgallery using PHP and i created a thumbnails to save the images in this thunmbnails . but i didnt know that many browsers like Chrome or firefox dont support the TIFF files .so i dont hv a choice just to create a PHP function to convert my TIFF files to jpg or png ...

    Do you have any Idea ?

    Hier is my Code :

    <?php
    $my_images_arr = scandir("images");
    // print_r($my_images_arr);
    $img_string = "";
    //  $imageFileTyp = pathinfo('images', PATHINFO_EXTENSION);
    
    
    
    foreach ($my_images_arr as $image_name) {
    	if(
    			strlen ($image_name) > 2   && strrpos($image_name,'.db') != true   
    			
    			)
    	
    		
          			
    	{
    		$img_string .= '<img src ="images/'.$image_name.'">';
    		
     
    	}
    	
    	
    	elseif 
    	(
    		strrpos($image_name,'.tif') === true
    	)
    	
    	{	
    	$image_name = preg_replace('.tif', '.jpg', $image_name);
    	
    	}
    	
    
    	
    }
    
    ?>
    
    
    
       
    
    
    <!DOCTYPE html>
    <html >
    <head>
        <title> Bilder Galerie </title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
       
      <style type="text/css">
    
         
          div#buttons{
          position:absolute;
          margin-left:-258px;
          
          }
           div#gHolder{
                width: 1348px;
                height: auto;
                margin: 0 auto;
                background-color: #FFA500;
                padding: 10px;
                position:fixed;
           }
           div#theBigImageHolder{
                width: 0px;
                height: 0px;
                background-color: white;
              
                
           }
           div#thumbnailsHolder{
                width: 393px;
                height: 940px;
                background-color: white;
                margin: -8px 14px auto;
                padding: 4px;
                overflow: auto;
                float: none;
           }
    	       div#Holder{
    	         background-color: #FFA500;
    	         width: 530px;
    	         height: 960px;
    	         float: right;
            
           }
    
           div#theBigImageHolder > img{
               
                border: 15px solid #3e2b14;
                width: 900px;
    	         height: 917px;
               /*margin: 71px 447px auto;*/         
               /*box-shadow: 0px 0px 3px 749px rgba(11, 12, 12, 0.95);*/
                 
    		     margin-top: -8px;
    		     margin-left:422px;
    		     top: 0;
    		     left: 0;
    		     right: 0;
    		     bottom: 0;*/
    		     
    		    
    	}
    		       
           div#thumbnailsHolder > img{
               width: 90px;
               height: 90px;
               display: block;
               float: left;
               margin: 2px;
               transition: border-radius 0.3s linear 0s;
               overflow: auto;
           }
           div#thumbnailsHolder > img:hover{
               border-radius: 100px;
               cursor:pointer;
    
           }
           
               
    	  </style>
    
    	  <script type ="text/javascript">
    	      function imgFunc() {
    	          var bigImage = document.getElementById("BigImage");
    	          var thumbnailsHolder = document.getElementById("thumbnailsHolder");
    
             thumbnailsHolder.addEventListener("click",function(event){
                 if (event.target.tagName == "IMG"){
                     bigImage.src = event.target.src;
                 }
                
             },false);
          }
          window.addEventListener("load",imgFunc,false);
    
    
          
    
    
       
          
    
       </script>
    </head>
    
    <body>
     
    
    
         <div id ="gHolder">
           <div id="theBigImageHolder">
              <?php
                  echo '<img src="images/'.$my_images_arr[0].'" id="BigImage">';
               ?> 
               <!--  <img src="images/mench.jpg" id="BigImage"> -->
           </div>
           <div id="thumbnailsHolder">
                 
                  <?php
                     echo $img_string;     
                   ?>
    
                  <!-- <img src="images/name1.jpg">
                   <img src="images/wolf.jpg">
                   <img src="images/panda.jpg">
                   <img src="images/hund.jpg">  
                   -->
                   
                   
             
           </div>
         </div>  
    
         <div id="Holder">
    <!--        <div id="buttons"> -->
    <!--        <form  action="upload.php" method="post" enctype="multipart/form-data"> -->
    <!--        <p>Bitte eine Datei auswaehlen<br> -->
    <!--        <input type="file" name="image"> <br> -->
    <!--        <input type="submit"  value="Hochladen">   -->
           
           
           
    <!--        </form> -->
    <!--        </div> -->
         
        <center> 
        <br><br> <form action="upload.php" method="post" enctype="multipart/form-data">
    		Datei auswaehlen:<input type="file" name="image"><br /><br />
    		beschreibung:<input type="text" name="desc"><br /><br />
    		<input type="submit" name="upload" value="Hochladen">
    	</form>
    	</center>
    	     </div>  
    
    </body>
    </html>

     

×
×
  • Create New...