@@ 608-638 (lines=31) @@ | ||
605 | $is_tmp_file = FALSE; |
|
606 | ||
607 | // find an image file among attached files |
|
608 | if($this->hasUploadedFiles()) |
|
609 | { |
|
610 | $file_list = $this->getUploadedFiles(); |
|
611 | ||
612 | $first_image = null; |
|
613 | foreach($file_list as $file) |
|
614 | { |
|
615 | if($file->direct_download !== 'Y') continue; |
|
616 | ||
617 | if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
618 | { |
|
619 | $source_file = $file->uploaded_filename; |
|
620 | break; |
|
621 | } |
|
622 | ||
623 | if($first_image) continue; |
|
624 | ||
625 | if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
626 | { |
|
627 | if(file_exists($file->uploaded_filename)) |
|
628 | { |
|
629 | $first_image = $file->uploaded_filename; |
|
630 | } |
|
631 | } |
|
632 | } |
|
633 | ||
634 | if(!$source_file && $first_image) |
|
635 | { |
|
636 | $source_file = $first_image; |
|
637 | } |
|
638 | } |
|
639 | ||
640 | // get an image file from the doc content if no file attached. |
|
641 | $is_tmp_file = false; |
@@ 877-907 (lines=31) @@ | ||
874 | $is_tmp_file = false; |
|
875 | ||
876 | // Find an iamge file among attached files if exists |
|
877 | if($this->hasUploadedFiles()) |
|
878 | { |
|
879 | $file_list = $this->getUploadedFiles(); |
|
880 | ||
881 | $first_image = null; |
|
882 | foreach($file_list as $file) |
|
883 | { |
|
884 | if($file->direct_download !== 'Y') continue; |
|
885 | ||
886 | if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
887 | { |
|
888 | $source_file = $file->uploaded_filename; |
|
889 | break; |
|
890 | } |
|
891 | ||
892 | if($first_image) continue; |
|
893 | ||
894 | if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
895 | { |
|
896 | if(file_exists($file->uploaded_filename)) |
|
897 | { |
|
898 | $first_image = $file->uploaded_filename; |
|
899 | } |
|
900 | } |
|
901 | } |
|
902 | ||
903 | if(!$source_file && $first_image) |
|
904 | { |
|
905 | $source_file = $first_image; |
|
906 | } |
|
907 | } |
|
908 | // If not exists, file an image file from the content |
|
909 | $is_tmp_file = false; |
|
910 | if(!$source_file) |