When you working with the image dimensions, it’s always recommended to get the real width and height of the image. The naturalWidth and naturalHeight property provide an easy way to retrieve the original dimensions of the image using JavaScript. You can easily get the original size (width and height) of the image using JavaScript.

By: CodexWorld Feb 18, 2019
PHP

Saving image from URL is very useful when you want to copy an image dynamically from the remote server and store in the local server. The file_get_contents() and file_put_contents() provides an easiest way to save remote image to local server using PHP. The image file can be saved straight to directory from the URL. You can also use cURL to save an image from URL using PHP.

By: CodexWorld Feb 13, 2019

The window.onload event is very useful when you want to call a JavaScript function on page load without using jQuery. Generally, $( document ).ready() is used to execute the JavaScript code after Document Object Model (DOM) is ready. You can use the window.onload event to call and execute a JavaScript function on page load without using jQuery.

By: CodexWorld Feb 7, 2019
PHP

The file_exists() function in PHP, is used to check if a file or directory exists on the server. But the file_exists() function will not usable if you want to check the file existence on the remote server. The fopen() function is the easiest solution to check if a file URL exists on a remote server using PHP. You can also use cURL to check if a URL exists on the remote server.

By: CodexWorld Oct 2, 2023
PHP

Stripping query parameter is very useful when you want to create a URL dynamically based on some conditions. The preg_replace() function is the easiest way to remove a specific parameter and its value from URL query string using PHP. PHP preg_replace() function searches string for matches to pattern and replace with the replacement. Use preg_replace() with REGEX to remove parameter from query string using PHP.

By: CodexWorld Jun 17, 2023

When you use LIKE operator to search and fetch the matched results from the database, the records are selected based on their entry. In LIKE search, the results must be sorted based on the word matches to make the result-set more relevance. Use ORDER BY keyword with LIKE to sort results by the best match in MySQL.

By: CodexWorld Jan 8, 2019
PHP

The Regular Expressions are the easiest option to change the characters format based on the specific pattern. You can change the word format in a string using PHP with Regex. If you want to separate bunched words in a string, put a space in front of each word. Use the preg_replace() with Regex to insert space in front of uppercase character in a string using PHP.

By: CodexWorld Jan 2, 2019
PHP

Before taking any action with date input, it always a great idea to validate the date string. Date validation helps to check whether the provided string is a valid date format. Using the DateTime class you can easily check if the date string is valid in PHP. It is very useful for server-side validation of the date input using PHP.

By: CodexWorld Dec 28, 2018
PHP

In the web application, generally, the file is downloaded from the same server. But sometimes the file needs to be downloaded from the remote server. But sometimes the file needs to be downloaded from the remote server. Use the readfile() function with application/x-file-to-save Content-type header, to download a ZIP file from remote URL using PHP.

By: CodexWorld Jun 27, 2022
keyboard_double_arrow_up