Image Content Management

1,326 views
1,186 views

Published on

Learn how to manipulate image content of ProdigyView’s built-in content management system. Also learn how to upload an image file directly to the cms.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,326
On SlideShare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
Downloads
12
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Image Content Management

  1. 1. Image Content Management
  2. 2. OverviewObjectiveLearn how to manipulate image content of ProdigyView’s built-in content management system. Also learn how to upload animage file directly to the cms.Requirements Installed version of ProdigyView with a database Understanding of base content Understanding of the DEFINES in ProdigyViewEstimated Time12 minutes www.prodigyview.com
  3. 3. Follow Along With Code Example1. Download a copy of the example code at www.prodigyview.com/source.2. Install the system in an environment you feel comfortable testing in.3. Proceed to examples/content/ImageContentExample.php
  4. 4. What Is Image Content?Image content is content involves displaying an image.Image Content in the cms supports uploading files directlyinto the cms. The formats that can be used with the fileupload is png, jpeg, and gifs. Use image for webapplications such as in the example below and what everyour imagination can expand too.  Galleries  Photo Albums  Showcases  Blogging  Ecommerce Products  etc www.prodigyview.com
  5. 5. Extends Base ContentLike the other content types, image content extends basecontent. This means it has all the fields that base contenthas in addition to the fields that describes an image. Image Content Fields Base Content Fields www.prodigyview.com
  6. 6. Create Image Content Image content is relatively easy to create. In an array, passed defined fields into PVContent::createImageContent method. 1. Define the content that will be stored as image content3. Return content id 2. Pass the array to PVContent::createTextContent
  7. 7. Database ViewRemember that the image content utilizes both the basecontent and image content fields. This is accomplishedby joining two tables. Your two tables in the databaseshould look something like below. Base Content Database View Image Content Database View
  8. 8. Image Content FieldsThe previous slide only showed afew fields that can be set whendefining image content. Here is acomplete list of fields that apply onlyto the image content. www.prodigyview.com
  9. 9. Creating An Image with FileA feature of the image content in ProdigyView is the abilityupload files while creating or updating content. For the nextexample, change your sample code toexamples/content/ImageContentExampleWithFile.php
  10. 10. Image File ArgumentsSimilar to creating a normal image, creating an image with a file isaccomplished through setting arguments. In the example below,we are using an image from our file system. But it can be set thesame way using PHP’s $_FILES global. 1. Name of the file 2. The location the file currently resides 3. The size of the file 4. The type of file
  11. 11. Create Image With a FileNow pass those arguments to thePVContent::createImageWithFile() method. The contentid will be return and the image placed in your PV_IMAGEdefine folder.
  12. 12. Database ViewThe file will be uploaded will be placed in the PV_IMAGE folderand a reference link will be placed in the database. Your databaseshould look something like this: 1. Mime type 2. Image size 3. Auto generated random file name 4. Generated file name of thumbnail www.prodigyview.com
  13. 13. Search for Image Content Using the syntax from the PV Standard Search Query, we can search for content related to images on using fields for both base content and image content. 1. Search based on the passed arguments 2. Pass args into getImageContentList() method3. Returns an array of arrays thatcontains the list of event content
  14. 14. Iterate Through The ListNext we can iterate through the list of image content tosee the data we just added.1. Iterate through the fields base content 2. With the automatic joining of the tables, image content fields are also returned
  15. 15. Retrieving Image ContentImage content can also be retrieved directly using thecontent id. The data associated with that event id will bereturned in array. 1. Pass in the content id2. Content is returned in an array3. Get the values of the array by specifyingthe associated index
  16. 16. Updating Image ContentThat array contains the information for updating image content.Simply change a value at an index in the array and pass it toPVContent::updateImageContent() method. Remember thecontent_id variable is required. 1. Update the owner id of the content array 2. Pass the array back to update
  17. 17. Updating With FileReferring back toexamples/content/ImageContentExampleWithFile.php, wecan also update the image file associated with the content id.The old file will be replaced. 1. Set the name of the file 2. The current location of the file to copy 3. The size of the file 4. The type of the file
  18. 18. Deleting Image ContentThe last action to take place is deleting the image content.To delete content, we pass the content id intoPVContent::deleteContent method.All the content types(audio, video, event, etc) use thePVContent::deleteContent method. Associated fileswill be deleted also. www.prodigyview.com
  19. 19. Review1. Create image content by passing an array of arguments into PVContent::createImageContent()2. PVContent::createImageContent() will return the id of the newly generated image content3. Search for image content by using the syntax from PV Standard Search Query and passing those arguments into PVContent::getImageContentList()4. Update content by passing an array of accepted fields in PVContent::updateImageContent(). The content_id must be present for this method to work.5. Delete image content by passing the content_id into PVContent::deleteContent(). www.prodigyview.com
  20. 20. API ReferenceFor a better understanding of image content, visit the apiby clicking on the link below.PVContent More TutorialsFor more tutorials, please visit:http://www.prodigyview.com/tutorials www.prodigyview.com

×