Subversion-Projekte lars-tiefland.ci

Revision

Revision 1257 | Revision 2107 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 1257 Revision 2049
Zeile 4... Zeile 4...
4
 *
4
 *
5
 * An open source application development framework for PHP
5
 * An open source application development framework for PHP
6
 *
6
 *
7
 * This content is released under the MIT License (MIT)
7
 * This content is released under the MIT License (MIT)
8
 *
8
 *
9
 * Copyright (c) 2014 - 2016, British Columbia Institute of Technology
9
 * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
10
 *
10
 *
11
 * Permission is hereby granted, free of charge, to any person obtaining a copy
11
 * Permission is hereby granted, free of charge, to any person obtaining a copy
12
 * of this software and associated documentation files (the "Software"), to deal
12
 * of this software and associated documentation files (the "Software"), to deal
13
 * in the Software without restriction, including without limitation the rights
13
 * in the Software without restriction, including without limitation the rights
14
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Zeile 27... Zeile 27...
27
 * THE SOFTWARE.
27
 * THE SOFTWARE.
28
 *
28
 *
29
 * @package	CodeIgniter
29
 * @package	CodeIgniter
30
 * @author	EllisLab Dev Team
30
 * @author	EllisLab Dev Team
31
 * @copyright	Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
31
 * @copyright	Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
32
 * @copyright	Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
32
 * @copyright	Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
33
 * @license	http://opensource.org/licenses/MIT	MIT License
33
 * @license	http://opensource.org/licenses/MIT	MIT License
34
 * @link	https://codeigniter.com
34
 * @link	https://codeigniter.com
35
 * @since	Version 1.0.0
35
 * @since	Version 1.0.0
36
 * @filesource
36
 * @filesource
37
 */
37
 */
Zeile 542... Zeile 542...
542
		 * it means we are altering the original. We'll
542
		 * it means we are altering the original. We'll
543
		 * set the destination filename and path accordingly.
543
		 * set the destination filename and path accordingly.
544
		 */
544
		 */
545
		if ($this->new_image === '')
545
		if ($this->new_image === '')
546
		{
546
		{
547
			$this->dest_image = $this->source_image;
547
			$this->dest_image  = $this->source_image;
548
			$this->dest_folder = $this->source_folder;
548
			$this->dest_folder = $this->source_folder;
549
		}
549
		}
550
		elseif (strpos($this->new_image, '/') === FALSE)
550
		elseif (strpos($this->new_image, '/') === FALSE && strpos($this->new_image, '\\') === FALSE)
551
		{
551
		{
-
 
552
			$this->dest_image  = $this->new_image;
552
			$this->dest_folder = $this->source_folder;
553
			$this->dest_folder = $this->source_folder;
553
			$this->dest_image = $this->new_image;
-
 
554
		}
554
		}
555
		else
555
		else
556
		{
556
		{
557
			if (strpos($this->new_image, '/') === FALSE && strpos($this->new_image, '\\') === FALSE)
-
 
558
			{
-
 
559
				$full_dest_path = str_replace('\\', '/', realpath($this->new_image));
-
 
560
			}
-
 
561
			else
-
 
562
			{
-
 
563
				$full_dest_path = $this->new_image;
-
 
564
			}
-
 
565
 
-
 
566
			// Is there a file name?
557
			// Is there a file name?
567
			if ( ! preg_match('#\.(jpg|jpeg|gif|png)$#i', $full_dest_path))
558
			if ( ! preg_match('#\.(jpg|jpeg|gif|png)$#i', $this->new_image))
568
			{
559
			{
569
				$this->dest_folder = $full_dest_path.'/';
560
				$this->dest_image  = $this->source_image;
570
				$this->dest_image = $this->source_image;
561
				$this->dest_folder = $this->new_image;
571
			}
562
			}
572
			else
563
			else
573
			{
564
			{
574
				$x = explode('/', $full_dest_path);
565
				$x = explode('/', str_replace('\\', '/', $this->new_image));
575
				$this->dest_image = end($x);
566
				$this->dest_image  = end($x);
576
				$this->dest_folder = str_replace($this->dest_image, '', $full_dest_path);
567
				$this->dest_folder = str_replace($this->dest_image, '', $this->new_image);
577
			}
568
			}
-
 
569
 
-
 
570
			$this->dest_folder = realpath($this->dest_folder).'/';
578
		}
571
		}
Zeile 579... Zeile 572...
579
 
572
 
580
		/* Compile the finalized filenames/paths
573
		/* Compile the finalized filenames/paths
581
		 *
574
		 *
Zeile 884... Zeile 877...
884
			{
877
			{
885
				$cmd .= ' -resize '.$this->width.'x'.$this->height.'\!';
878
				$cmd .= ' -resize '.$this->width.'x'.$this->height.'\!';
886
			}
879
			}
887
		}
880
		}
Zeile 888... Zeile 881...
888
 
881
 
Zeile 889... Zeile 882...
889
		$cmd .= escapeshellarg($this->full_src_path).' '.escapeshellarg($this->full_dst_path).' 2>&1';
882
		$cmd .= ' '.escapeshellarg($this->full_src_path).' '.escapeshellarg($this->full_dst_path).' 2>&1';
890
 
883
 
891
		$retval = 1;
884
		$retval = 1;
892
		// exec() might be disabled
885
		// exec() might be disabled
Zeile 1644... Zeile 1637...
1644
			$this->set_error('imglib_invalid_path');
1637
			$this->set_error('imglib_invalid_path');
1645
			return FALSE;
1638
			return FALSE;
1646
		}
1639
		}
Zeile 1647... Zeile 1640...
1647
 
1640
 
-
 
1641
		$vals = getimagesize($path);
-
 
1642
		if ($vals === FALSE)
-
 
1643
		{
-
 
1644
			$this->set_error('imglib_invalid_image');
-
 
1645
			return FALSE;
-
 
1646
		}
1648
		$vals = getimagesize($path);
1647
 
1649
		$types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
1648
		$types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
Zeile 1650... Zeile 1649...
1650
		$mime = (isset($types[$vals[2]])) ? 'image/'.$types[$vals[2]] : 'image/jpg';
1649
		$mime = isset($types[$vals[2]]) ? 'image/'.$types[$vals[2]] : 'image/jpg';
1651
 
1650
 
1652
		if ($return === TRUE)
1651
		if ($return === TRUE)
1653
		{
1652
		{
1654
			return array(
1653
			return array(
1655
					'width' =>	$vals[0],
1654
				'width'      => $vals[0],
1656
					'height' =>	$vals[1],
1655
				'height'     => $vals[1],
1657
					'image_type' =>	$vals[2],
1656
				'image_type' => $vals[2],
1658
					'size_str' =>	$vals[3],
1657
				'size_str'   => $vals[3],
1659
					'mime_type' =>	$mime
1658
				'mime_type'  => $mime
Zeile 1660... Zeile 1659...
1660
				);
1659
			);
1661
		}
1660
		}
1662
 
1661
 
1663
		$this->orig_width	= $vals[0];
1662
		$this->orig_width  = $vals[0];
1664
		$this->orig_height	= $vals[1];
1663
		$this->orig_height = $vals[1];
Zeile 1665... Zeile 1664...
1665
		$this->image_type	= $vals[2];
1664
		$this->image_type  = $vals[2];
1666
		$this->size_str		= $vals[3];
1665
		$this->size_str    = $vals[3];
Zeile 1667... Zeile 1666...
1667
		$this->mime_type	= $mime;
1666
		$this->mime_type   = $mime;