Explore Drupal 7 fields/CCK and master their use
We have learned how to add file fields to content types. In this section, we will learn how to add image fields to content types so that we can attach images to our content.
In this section, we will add an image field to the Recipe content type. Follow these steps:
(Move the mouse over the image to enlarge it.)
(Move the mouse over the image to enlarge it.)
We added an image field to the Recipe content type.
The process of adding an image field to the Recipe content type is similar to the process of adding a file field to the Recipe content type, except that we selected image field as the field type and we selected image as the field widget. We will configure the image field in the next section.
We have already added the image field. In this section, we will configure the image field, learn how to configure the image field settings, and understand how they reflect to image outputs by using those settings.
In this section, we will configure image field settings in the Recipe content type. Follow these steps:
(Move the mouse over the image to enlarge it.)
(Move the mouse over the image to enlarge it.)
(Move the mouse over the image to enlarge it.)
(Move the mouse over the image to enlarge it.)
(Move the mouse over the image to enlarge it.)
(Move the mouse over the image to enlarge it.)
(Move the mouse over the image to enlarge it.)
(Move the mouse over the image to enlarge it.)
We have added and configured an image field for the Recipe content type.
We left the default values in the Label field, the Required field, and the Help text field. They are the most common settings in fields.
The Allowed file extension section is similar to the file field that we have seen, which provides us with the ability to enter the file extension of the images which are allowed to be uploaded.
The File directory field is the same as the one in the file field, which provides us with the option to save the uploaded files to a different directory to the default location of the file directory.
The Preview image style select list allows us to select which image style will be used to display while editing content. Currently it provides three image styles, thumbnail, medium, and large. The thumbnail image style will be used by default. We will learn how to create a custom image style in the next section.
It’s time for another challenge. We have created an image field to the Recipe content type. We can use the same method we have learned here to add and configure an image field to the Cooking Tip content type. You can apply the same steps used to create image fields to the Recipe content type and try to understand the differences between the settings on the image field settings administration page.
I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…
Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…
Once we learn how to deploy an Ubuntu server, how to manage users, and how…
Key-takeaways: Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…
While developing a web application, or setting dynamic pages and meta tags we need to deal with…
Software architecture is one of the most discussed topics in the software industry today, and…