Showing posts with label Apex. Show all posts
Showing posts with label Apex. Show all posts

Friday, July 1, 2016

How to have a image crop functionality in salesforce

Many time there is a custom requirement(generally in community) that a user can upload images, and when they do so there should be a functionality to crop or rotate it. We can achive it by using "corpper.js" Link.

Note: This page will through a viewstate error, due to base64 string size, try using transient variable to solve this.


Tuesday, September 23, 2014

How to display a image if you have Bas64 sting on a visualforcfe page

Ok so recently I got a requirement that the image is saved in a Base64 format and when it is displayed it should be displayed as image.

What? Right and here is a small trick to do the job.

<img alt="<image_Name>" src="data:image/<image_File_Extension>;base64, <base64_Image_String>"></img>
http://developer.force.com/cookbook/recipe/converting-a-rich-text-area-fields-image-for-api-upload

Hope this helps!!

Thursday, August 7, 2014

How to play video in visualforce from attachment

So we have developed many data driven pages but when it comes to multimedia then many of us didn't worked on it much. We are thing "Ok its just a video or a image I will display it by getting its path" but the problem arise when its(the MIME file) is an attachment. Attachments are stored in database unlikely if compared from static resource which has a direct access URL. So how can I display a multimedia file if its type is BLOB.

The answer is here, we can use <object> tag or we can have <video> tag of HTML5.
for <object> tag, here the {!crwAtt.id} is Attachment object.
hor <video> tag, remember to add "docType="html-5.0"" to page.