Best web design - PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY The
PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY The if statement uses two functions, file_exists() and is_readable(), to make sure $selectedImage not only exists, but also that it s accessible (it may be corrupted or have the wrong permissions). These functions return Boolean values (true or false), so they can be used directly as part of the conditional statement. The single line inside the if statement uses the function getimagesize() to get the image s dimensions. The function returns an array containing four elements. By assigning the result to $imageSize, you can extract the following information: $imageSize[0]: The width of the image in pixels $imageSize[1]: The height of the image in pixels $imageSize[2]: A number indicating the type of file (see Chapter 8 for details) $imageSize[3]: A string containing the height and width for use in an tag The first and last items in this array are just what you need to solve the problem shown in Figure 4-9. 5. First of all, let s fix the code in step 2. Change it like this:
This inserts the correct width and height attributes inside the tag. 6. Although this sets the dimensions for the image, you still need to control the width of the caption. You can t use PHP inside an external stylesheet, but there s nothing stopping you from creating a style block in the
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.