@@ 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; |
@@ 883-913 (lines=31) @@ | ||
880 | $is_tmp_file = false; |
|
881 | ||
882 | // Find an iamge file among attached files if exists |
|
883 | if($this->hasUploadedFiles()) |
|
884 | { |
|
885 | $file_list = $this->getUploadedFiles(); |
|
886 | ||
887 | $first_image = null; |
|
888 | foreach($file_list as $file) |
|
889 | { |
|
890 | if($file->direct_download !== 'Y') continue; |
|
891 | ||
892 | if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
893 | { |
|
894 | $source_file = $file->uploaded_filename; |
|
895 | break; |
|
896 | } |
|
897 | ||
898 | if($first_image) continue; |
|
899 | ||
900 | if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
901 | { |
|
902 | if(file_exists($file->uploaded_filename)) |
|
903 | { |
|
904 | $first_image = $file->uploaded_filename; |
|
905 | } |
|
906 | } |
|
907 | } |
|
908 | ||
909 | if(!$source_file && $first_image) |
|
910 | { |
|
911 | $source_file = $first_image; |
|
912 | } |
|
913 | } |
|
914 | // If not exists, file an image file from the content |
|
915 | $is_tmp_file = false; |
|
916 | if(!$source_file) |