diff --git a/.gitignore b/.gitignore index 50fd757..4d445f1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ build composer.lock docs vendor +.idea coverage bladeimagecrop.sublime-project bladeimagecrop.sublime-workspace \ No newline at end of file diff --git a/.idea/BladeImageCrop.iml b/.idea/BladeImageCrop.iml index 6071ba4..fb266f8 100644 --- a/.idea/BladeImageCrop.iml +++ b/.idea/BladeImageCrop.iml @@ -128,6 +128,8 @@ + + diff --git a/.idea/blade.xml b/.idea/blade.xml index 4f345f0..a6b2263 100644 --- a/.idea/blade.xml +++ b/.idea/blade.xml @@ -81,6 +81,7 @@ + @@ -112,6 +113,7 @@ + diff --git a/.idea/php.xml b/.idea/php.xml index 42fa338..56482dc 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -136,6 +136,10 @@ + + + + diff --git a/.phpunit.result.cache b/.phpunit.result.cache index 1c579da..1d770f3 100644 --- a/.phpunit.result.cache +++ b/.phpunit.result.cache @@ -1 +1 @@ -{"version":1,"defects":{"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_exists_return_file_url":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_doens_t_exists_return_file_url_and_make_new_directory_and_file":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::setUp":5,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_no_image_found_return_null":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_in_correct_directory_exists_return_file_url":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::get_a_list_of_sources_from_an_image":5,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourcesTest::if_blade_command_sources_requested_return_a_html_string":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourceTest::return_source_object_with_all_options":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourceTest::calculate_the_uris_from_the_srcset_lines":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_exists_with_webp_format_return_file_url":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_an_image":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_a_webp_image":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_a_short_pixel_jpg_image":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_a_jpeg_image":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_directory_from_uri":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_filename_from_uri":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_path_from_uri":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourcesTest::if_properties_is_not_dynamic_throw_exception":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourcesTest::if_blade_command_sources_requested_with_many_properties_return_a_html_string":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::update_url_returns_proper_url":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_x_img_component_and_return_filled_img_tag":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\PropsTest::take_width_and_aspect_and_return_props_array":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_class_and_alt_tag_and_see_them_in_the_result":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_properties_and_see_them_in_the_result":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::set_changed_default_and_see_them_in_the_result":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::set_no_background_and_see_it_removed_from_the_result":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_width_and_aspect_and_return_props_array":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_dimensions_and_return_props_array":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_full_props_plus_one_width_and_return_props_array":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_full_props_plus_one_width_string_and_return_props_array":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourceTest::calculate_the_uris_pixel_ratio_from_the_srcset_lines":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_width_and_aspect_with_changed_config_and_return_props_array":3,"Warning":6,"DNABeast\\BladeImageCrop\\Tests\\Unit\\BackgroundTest::src_of_image_returns_svg_string":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_x_img_component_with_1_prop_and_return_filled_img_tag":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::turn_sources_off_and_dont_see_srcset_at_all":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\PicTest::provide_pic_tag_and_get_htmt":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\PicTest::provide_pic_tag_and_get_html":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_broken_width_and_aspect_and_return_props_array":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_exists_on_correct_disk_return_file_url":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_file_has_directory_but_is_not_a_file_it_should_return_image_not_found":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_file_has_no_extensions_should_return_image_not_found":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_url_has_directory_but_is_not_a_file_it_should_return_image_not_found":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_file_is_not_an_image_return_false":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\BackgroundTest::empty_source_returns_image_not_found":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::trim_storage_folder_from_uri":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_disk_directory":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::dont_trim_storage_folder_from_uri":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\BackgroundTest::src_of_image_returns_png_string":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_no_image_found_return_imagenotfound":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_a_local_image_that_exists_returns_path":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_a_local_image_that_doesn_t_exists_returns_fail_message":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_an_online_image_that_exists_returns_path":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_an_online_image_that_doesn_t_exists_returns_fail_message":5,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::get_newly_calculated_size_options_for_the_builder":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::dont_resize_image_if_target_is_bigger_than_original_image":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::if_the_config_option_to_compress_the_hold_image_is_set_the_held_image_should_be_smaller_than_the_original_image":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::set_background_and_see_it_with_the_correct_result":4},"times":{"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_no_image_found_return_null":0.024,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_exists_return_file_url":0.036,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_doens_t_exists_return_file_url_and_make_new_directory_and_file":0.013,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::setUp":0.043,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_in_correct_directory_exists_return_file_url":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_exists_on_correct_disk_return_file_url":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::get_a_list_of_sources_from_an_image":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourcesTest::if_blade_command_sources_requested_return_a_html_string":0.004,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourceTest::return_source_object_with_all_options":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourceTest::calculate_the_uris_from_the_srcset_lines":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_exists_with_webp_format_return_file_url":0.028,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_an_image":0.072,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_a_webp_image":0.143,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_a_short_pixel_jpg_image":6.197,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_a_jpeg_image":0.091,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_directory_from_uri":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_filename_from_uri":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_path_from_uri":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourcesTest::if_properties_is_not_dynamic_throw_exception":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourcesTest::if_blade_command_sources_requested_with_many_properties_return_a_html_string":0.004,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::update_url_returns_proper_url":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_x_img_component_and_return_filled_img_tag":0.02,"DNABeast\\BladeImageCrop\\Tests\\Unit\\PropsTest::take_width_and_aspect_and_return_props_array":0.046,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_class_and_alt_tag_and_see_them_in_the_result":0.004,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_properties_and_see_them_in_the_result":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::set_changed_default_and_see_them_in_the_result":0.004,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::set_no_background_and_see_it_removed_from_the_result":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_width_and_aspect_and_return_props_array":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_dimensions_and_return_props_array":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_full_props_plus_one_width_and_return_props_array":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_full_props_plus_one_width_string_and_return_props_array":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourceTest::calculate_the_uris_pixel_ratio_from_the_srcset_lines":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_width_and_aspect_with_changed_config_and_return_props_array":0.002,"Warning":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\BackgroundTest::src_of_image_returns_svg_string":0.027,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_prop_and_aspect_and_return_props_array":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_x_img_component_with_1_prop_and_return_filled_img_tag":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::turn_sources_off_and_dont_see_srcset_at_all":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_two_full_props_plus_one_width_string_and_return_props_array":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\PicTest::provide_pic_tag_and_get_htmt":0.035,"DNABeast\\BladeImageCrop\\Tests\\Unit\\PicTest::provide_pic_tag_and_get_html":0.005,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_broken_width_and_aspect_and_return_props_array":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_file_has_directory_but_is_not_a_file_it_should_return_image_not_found":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_url_has_directory_but_is_not_a_file_it_should_return_image_not_found":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_file_has_no_extensions_should_return_image_not_found":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_file_is_not_an_image_return_false":0.007,"DNABeast\\BladeImageCrop\\Tests\\Unit\\BackgroundTest::empty_source_returns_image_not_found":0.004,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::trim_storage_folder_from_uri":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_disk_directory":0.045,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::dont_trim_storage_folder_from_uri":0.027,"DNABeast\\BladeImageCrop\\Tests\\Unit\\BackgroundTest::src_of_image_returns_png_string":0.118,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_no_image_found_return_imagenotfound":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_a_local_image_that_exists_returns_path":0.005,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_a_local_image_that_doesn_t_exists_returns_fail_message":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_an_online_image_that_exists_returns_path":0.017,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_an_online_image_that_doesn_t_exists_returns_fail_message":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::get_newly_calculated_size_options_for_the_builder":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::dont_resize_image_if_target_is_bigger_than_original_image":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::only_crop_image_if_target_is_bigger_than_original_image":0.029,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::if_the_config_option_to_compress_the_hold_image_is_set_the_held_image_should_be_smaller_than_the_original_image":0.033,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::set_background_and_see_it_with_the_correct_result":0.043}} \ No newline at end of file +{"version":1,"defects":{"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_exists_return_file_url":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_doens_t_exists_return_file_url_and_make_new_directory_and_file":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::setUp":5,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_no_image_found_return_null":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_in_correct_directory_exists_return_file_url":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::get_a_list_of_sources_from_an_image":5,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourcesTest::if_blade_command_sources_requested_return_a_html_string":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourceTest::return_source_object_with_all_options":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourceTest::calculate_the_uris_from_the_srcset_lines":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_exists_with_webp_format_return_file_url":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_an_image":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_a_webp_image":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_a_short_pixel_jpg_image":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_a_jpeg_image":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_directory_from_uri":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_filename_from_uri":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_path_from_uri":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourcesTest::if_properties_is_not_dynamic_throw_exception":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourcesTest::if_blade_command_sources_requested_with_many_properties_return_a_html_string":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::update_url_returns_proper_url":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_x_img_component_and_return_filled_img_tag":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\PropsTest::take_width_and_aspect_and_return_props_array":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_class_and_alt_tag_and_see_them_in_the_result":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_properties_and_see_them_in_the_result":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::set_changed_default_and_see_them_in_the_result":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::set_no_background_and_see_it_removed_from_the_result":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_width_and_aspect_and_return_props_array":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_dimensions_and_return_props_array":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_full_props_plus_one_width_and_return_props_array":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_full_props_plus_one_width_string_and_return_props_array":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourceTest::calculate_the_uris_pixel_ratio_from_the_srcset_lines":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_width_and_aspect_with_changed_config_and_return_props_array":3,"Warning":6,"DNABeast\\BladeImageCrop\\Tests\\Unit\\BackgroundTest::src_of_image_returns_svg_string":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_x_img_component_with_1_prop_and_return_filled_img_tag":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::turn_sources_off_and_dont_see_srcset_at_all":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\PicTest::provide_pic_tag_and_get_htmt":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\PicTest::provide_pic_tag_and_get_html":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_broken_width_and_aspect_and_return_props_array":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_exists_on_correct_disk_return_file_url":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_file_has_directory_but_is_not_a_file_it_should_return_image_not_found":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_file_has_no_extensions_should_return_image_not_found":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_url_has_directory_but_is_not_a_file_it_should_return_image_not_found":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_file_is_not_an_image_return_false":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\BackgroundTest::empty_source_returns_image_not_found":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::trim_storage_folder_from_uri":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_disk_directory":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::dont_trim_storage_folder_from_uri":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\BackgroundTest::src_of_image_returns_png_string":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_no_image_found_return_imagenotfound":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_a_local_image_that_exists_returns_path":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_a_local_image_that_doesn_t_exists_returns_fail_message":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_an_online_image_that_exists_returns_path":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_an_online_image_that_doesn_t_exists_returns_fail_message":5,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::get_newly_calculated_size_options_for_the_builder":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::dont_resize_image_if_target_is_bigger_than_original_image":3,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::if_the_config_option_to_compress_the_hold_image_is_set_the_held_image_should_be_smaller_than_the_original_image":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::set_background_and_see_it_with_the_correct_result":4,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::set_as_disabled_means_original_filename_is_used":4},"times":{"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_no_image_found_return_null":0.024,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_exists_return_file_url":0.031,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_doens_t_exists_return_file_url_and_make_new_directory_and_file":0.013,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::setUp":0.043,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_in_correct_directory_exists_return_file_url":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_exists_on_correct_disk_return_file_url":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::get_a_list_of_sources_from_an_image":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourcesTest::if_blade_command_sources_requested_return_a_html_string":0.004,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourceTest::return_source_object_with_all_options":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourceTest::calculate_the_uris_from_the_srcset_lines":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_correct_file_exists_with_webp_format_return_file_url":0.027,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_an_image":0.072,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_a_webp_image":0.146,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_a_short_pixel_jpg_image":6.197,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageBuilderTest::creates_and_saves_a_jpeg_image":0.096,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_directory_from_uri":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_filename_from_uri":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_path_from_uri":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourcesTest::if_properties_is_not_dynamic_throw_exception":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourcesTest::if_blade_command_sources_requested_with_many_properties_return_a_html_string":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::update_url_returns_proper_url":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_x_img_component_and_return_filled_img_tag":0.012,"DNABeast\\BladeImageCrop\\Tests\\Unit\\PropsTest::take_width_and_aspect_and_return_props_array":0.046,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_class_and_alt_tag_and_see_them_in_the_result":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_properties_and_see_them_in_the_result":0.004,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::set_changed_default_and_see_them_in_the_result":0.004,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::set_no_background_and_see_it_removed_from_the_result":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_width_and_aspect_and_return_props_array":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_dimensions_and_return_props_array":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_full_props_plus_one_width_and_return_props_array":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_full_props_plus_one_width_string_and_return_props_array":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\SourceTest::calculate_the_uris_pixel_ratio_from_the_srcset_lines":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_width_and_aspect_with_changed_config_and_return_props_array":0.002,"Warning":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\BackgroundTest::src_of_image_returns_svg_string":0.027,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_prop_and_aspect_and_return_props_array":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::give_x_img_component_with_1_prop_and_return_filled_img_tag":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::turn_sources_off_and_dont_see_srcset_at_all":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_two_full_props_plus_one_width_string_and_return_props_array":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\PicTest::provide_pic_tag_and_get_htmt":0.035,"DNABeast\\BladeImageCrop\\Tests\\Unit\\PicTest::provide_pic_tag_and_get_html":0.004,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImagePropsTest::take_broken_width_and_aspect_and_return_props_array":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_file_has_directory_but_is_not_a_file_it_should_return_image_not_found":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_url_has_directory_but_is_not_a_file_it_should_return_image_not_found":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_file_has_no_extensions_should_return_image_not_found":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_file_is_not_an_image_return_false":0.009,"DNABeast\\BladeImageCrop\\Tests\\Unit\\BackgroundTest::empty_source_returns_image_not_found":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::trim_storage_folder_from_uri":0.001,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::get_disk_directory":0.045,"DNABeast\\BladeImageCrop\\Tests\\Unit\\UriHelperTest::dont_trim_storage_folder_from_uri":0.027,"DNABeast\\BladeImageCrop\\Tests\\Unit\\BackgroundTest::src_of_image_returns_png_string":0.075,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::if_no_image_found_return_imagenotfound":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_a_local_image_that_exists_returns_path":0.004,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_a_local_image_that_doesn_t_exists_returns_fail_message":0.003,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_an_online_image_that_exists_returns_path":0.016,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::give_it_an_online_image_that_doesn_t_exists_returns_fail_message":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::get_newly_calculated_size_options_for_the_builder":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::dont_resize_image_if_target_is_bigger_than_original_image":0.002,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImageCropTest::only_crop_image_if_target_is_bigger_than_original_image":0.029,"DNABeast\\BladeImageCrop\\Tests\\Unit\\HoldImageTest::if_the_config_option_to_compress_the_hold_image_is_set_the_held_image_should_be_smaller_than_the_original_image":0.035,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::set_background_and_see_it_with_the_correct_result":0.043,"DNABeast\\BladeImageCrop\\Tests\\Unit\\ImgTest::set_as_disabled_means_original_filename_is_used":0.08}} \ No newline at end of file diff --git a/README.md b/README.md index f9353ce..bd77440 100644 --- a/README.md +++ b/README.md @@ -270,6 +270,16 @@ The background builder can also be over written. Currently it takes the images a If you wanted to (for instance) change this to load the same loading image you can write your own builder and swap it in with the config. ## Troubleshooting +**Is the site crashing and you're freaking out?** +Sometimes a weird file get through. I've tried my best to get rid of potential crashes but I can never underestimate the ingenuity of fools. If you need to turn off the process there is a config option. +``` +'enabled' => env('BLADE_CROP_ENABLED', false), +``` +or set it in your .env +``` +BLADE_CROP_ENABLED=false +``` + **Are you getting this error?** ``` syntax error, unexpected end of file, expecting "elseif" or "else" or "endif" diff --git a/config/bladeimagecrop.php b/config/bladeimagecrop.php index c0e0251..3c40ab2 100644 --- a/config/bladeimagecrop.php +++ b/config/bladeimagecrop.php @@ -1,6 +1,7 @@ env('BLADE_CROP_ENABLED', true), 'disk' => 'public', 'offset_x' => 50, // percentage 'offset_y' => 50, diff --git a/src/HoldImage.php b/src/HoldImage.php index 5e9c025..78ef301 100644 --- a/src/HoldImage.php +++ b/src/HoldImage.php @@ -23,6 +23,7 @@ public function path(){ } public function file(){ + $extension = strtolower($this->src->explode('.')->last()); $formattedFileName = $this->src->slug.'.'.$extension; // if file exists then return it diff --git a/src/View/Components/Img.php b/src/View/Components/Img.php index f2450e3..7f551b0 100644 --- a/src/View/Components/Img.php +++ b/src/View/Components/Img.php @@ -7,6 +7,7 @@ use DNABeast\BladeImageCrop\ImageProps; use DNABeast\BladeImageCrop\Source; use Illuminate\Support\Facades\Storage; +use Illuminate\Support\Str; use Illuminate\View\Component; @@ -34,6 +35,10 @@ public function __construct($src, $width=null, $properties=null, $sources=null) */ public function render() { + if (!config('bladeimagecrop.enabled', true)){ + return ''; + } + return function (array $data){ $build = $this->build(); @@ -47,7 +52,6 @@ public function render() public function build(){ - $format = config('bladeimagecrop.build_classes'); $options = [ 'src' => $this->image->file(), 'format' => array_keys(config('bladeimagecrop.build_classes'))[count(config('bladeimagecrop.build_classes'))-1], @@ -60,7 +64,7 @@ public function build(){ $defaultImageSrc = explode(" ", $lines)[0]; if (config('bladeimagecrop.backgrounds')){ - $backgroundLocation = 'blade_image_crop_holding/'.str($defaultImageSrc)->after('blade_image_crop_holding'); + $backgroundLocation = 'blade_image_crop_holding/'.Str::of($defaultImageSrc)->after('blade_image_crop_holding'); $backgroundString = (new Background($backgroundLocation))->render(); } diff --git a/src/View/Components/Pic.php b/src/View/Components/Pic.php index db377d0..4ff0ff1 100644 --- a/src/View/Components/Pic.php +++ b/src/View/Components/Pic.php @@ -24,6 +24,10 @@ public function __construct($src, $width=null, $properties=null) */ public function render() { + if (!config('bladeimagecrop.enabled', true)){ + return ''; + } + return function (array $data){ $attributes = $data['attributes']->toHtml(); $propertyString = is_string($this->properties)?$this->properties:"[".implode(",", $this->properties)."]"; diff --git a/src/View/Components/Sources.php b/src/View/Components/Sources.php index 0e39e7c..c8c81e9 100644 --- a/src/View/Components/Sources.php +++ b/src/View/Components/Sources.php @@ -34,6 +34,9 @@ public function __construct($src, $properties, $media = null, $sizes = null) */ public function render() { + if (!config('bladeimagecrop.enabled', true)){ + return ''; + } return $this->build(); } diff --git a/tests/Unit/ImgTest.php b/tests/Unit/ImgTest.php index 03669a4..cceee0c 100644 --- a/tests/Unit/ImgTest.php +++ b/tests/Unit/ImgTest.php @@ -171,4 +171,5 @@ function turn_sources_off_and_dont_see_srcset_at_all(){ $result->assertSee($expected, false); } + }