I am using the Picture Library SlideShow Web Part and I want to show the actual image not the preview image.
I found a solution to use JQUERY to expand the width of the preview image to the width I want on the page, but this of course ruins the quality of the image.
The actual image the was uploaded will be in a path: /Home%20Page%20Banners/Banner2.jpg
SharePoint creates a preview images and placed is in another path and renames the file, for example: /Home%20Page%20Banners/_w/Banner2_jpg.jpg
My question is how can I get the preview image to show the acutal full image that was uploaded and not the scaled down image?
Picture Library SlideShow web part class is marked a sealed, so there is no way to extend it.
But it could be customized on the client side, to be more precise functions from Slideshow library (imglib.js) could be overridden.
How to display full-sized(original) images in Picture Library Slideshow web part
The solution described below allows to display original images in Slideshow web part. In order accomplish it the function for initializing picture in slideshow should be overridden (see the code below).
Step 1. Save below JavaScript code to the file, for example in SlideshowObjectInitializer.txt and upload it to SiteAssets Library
<script type="text/javascript">
function SlideshowObjectInitializer() {
ShowPic = (function(ShowPicOrig) {
return function() {
var ssObj = arguments[0]; //SlideShow object
var curPicIdx=ssObj.index; //current picture index
ShowPicOrig.apply(this, arguments); //call original ShowPic
//apply some changes to display original picture in SlideShow control
ssObj.image.src = ssObj.linkArray[curPicIdx]; //display original image instead of web image
//change picture & container size to auto instead of fixed (by default web image size is used)
ssObj.image.setAttribute('height','100%');
ssObj.image.setAttribute('width','100%');
var cell = ssObj.cell;
cell.style.width = 'auto';
cell.style.height = 'auto';
cell.style.display = '';
var pcell = ssObj.cell.parentNode;
pcell.style.width = 'auto';
pcell.style.height = 'auto';
};
})(ShowPic);
}
ExecuteOrDelayUntilScriptLoaded(SlideshowObjectInitializer, 'imglib.js');
</script>
Step 2. Add Content Editor web part (CEWP) on page where Slideshow web part is located and in the Content Editor tool pane, under Content Link, type /SiteAssets/SlideshowObjectInitializer.txt.
For more details about customizing Slideshow web part please follow this blogpost
Related
I am trying to change the page size on pdf to ledger when downloading. It is staying the same See code below
//trigger download of data.pdf file
$("#download-pdf").click(function(){
dsDetails.download("pdf", "data.pdf", {
orientation:"landscape", //set page orientation to landscape
units:"mm",
format:"279,432",
title:"Opportunity Details", //add title to report
});
})
the units and format options you are using are not valid download parameters for the PDF downloader, the only available properties are orientation, title and autoTable.
The autoTable property can take any of the standard auto table options, which can be found on their git repo: https://github.com/simonbengtsson/jsPDF-AutoTable#options
At the moment it is not possible to set any jsPDF options through the params, but this will be coming in the next release
Is it possible to remove/disable the selection of the Image Rendition when selecting a picture in a custom content type?
Any User/Contributer should not be able to choose the image Rendition because it happens programmatically in the Display Template. The Picture must always be choosen as Full Size Image!
Has anyone an idea how i can set this up?
As i remember Image Renditions are implemented using query string params so you can always ignore provided by user image rendition and override it in your display template.
I imported the picture in the Item_Custom.html Template (masterpages\Display Templates\Cotrol Web Parts\Item_Custom.html) like I did in the other Templates:
<mso:ManagedPropertyMapping msdt:dt="string">'Category Image'{Category Image}:'MyCategoryImageOWSIMGE',' .... </mso:ManagedPropertyMapping>
Then Set the JS Variable:
<!--#_
var CategoryImage = $getItemValue(ctx, "Category Image");
_#-->
And manually set the Rendition ID, no matter what was choosen by the user:
<img style="visibility: visible;" src="_#= CategoryImage =#_?RenditionID=7" id="CategoryImage" onload ... >
I’ve to display a image in a picture box in VisualWebGui. I’ve image in string format.
string ImageString_P;
FileStream fs_P = new FileStream(LocalDirectory + "Page_2.tif", FileMode.Open, FileAccess.Read);
byte[] picbyte_P = new byte[fs_P.Length];
fs_P.Read(picbyte_P, 0, Convert.ToInt32(fs_P.Length));
ImageString_P = Convert.ToBase64String(picbyte_P);
Now, how can I display this image(ImageString_P) in the picture box. Should I create the image of this string data or can I directly display this data in the PictureBox?
If I’ll create the image in a path(suppose “c:\xyz.jpg”) . How it (xyz.jpg) will be displayed in the picturebox.
Visual WebGui is a web application and as such it basically needs to let the browser specifically request any graphics data that should be rendered, which is fundamentally different from that of desktop applications, where you can simply assign the graphics data itself to the image property of a PictureBox.
If you study how a webpage with a PictureBox is rendered to the browser in Visual WebGui, you will see that the PictureBox is rendered as an img tag with the source being set to an Url, which is responsible for serving the image to the browser. When the browser sees that Url on the img tag, it issues another request to the server for the contents of that Url. This "secondary" request is called a gateway request in Visual WebGui.
To serve the graphics to the browser, you need some kind of Gateway in your Visual WebGui application. There are a few types of predefined gateways in Visual WebGui, like for Images (ImageResourceHandle) and icons (IconResourceHandle), but in this case you have a dynamically generated image, so you will need to define your own gateway to serve the graphics contents.... or you can write the image data to, say, Resources\Images folder of your application and then use an ImageResourceHandle to reference it.
Defining your own gateways in Visual WebGui is very simple, and you can see quite a few examples here.
Hope this helps,
Palli
You can do like this:
string ImageString_P;
FileStream fs_P = new FileStream(LocalDirectory + "Page_2.tif", FileMode.Open, FileAccess.Read);
byte[] picbyte_P = new byte[fs_P.Length];
this.picMyPicture.Image = new DynamicStreamResourceHandle(contentBitmap, "image/jpeg");
and it should render fine.
My packaged app gets images from google drive and then display them on the side. But I can't get the images to be displayed. I am trying to get the url of the image so that I can put that url in an image source. The image url that I am getting is actually an html page rather than jpeg, png etc. I have looked at the reference guide for google picker but nothing seems to work.
I am using this
function pickerCallback(data) {
if (data.action == google.picker.Action.PICKED) {
var fileId = data.docs[0].id;
fileName = data.docs[0].name;
imgURL = data.docs[0].url;
}
I want to use imgURL as the source for image selection but imgURL is not something like "https//:www.example.com/image.jpg. It is rather an html page I want something that ends with file type only then it will be able to display the image. Please let me know how can I get the image to be displayed in html page of my packaged app after selecting it from google drive.
You should fetch the metadata of the image, then use the webContentLink of the image, then the user can view it in a logged in browser. See the documentation on downloads for more information.
How can you add images to a Google Document (not Spreadsheet or Presentation) via Google Apps Script. I don't see an addImage method. Surely the team would not have left this out.
http://code.google.com/googleapps/appsscript/class_document.html
From the docs:
function insertImage() {
// Retrieve an image from the web.
var resp = UrlFetchApp.fetch("http://www.google.com/intl/en_com/images/srpr/logo2w.png");
// Create a document.
var doc = DocumentApp.openById("");
// Append the image to the first paragraph.
doc.getChild(0).asParagraph().appendInlineImage(resp.getBlob());
}
http://code.google.com/googleapps/appsscript/class_documentapp_listitem.html#appendInlineImage
I'm not sure if you can upload an image. But you sure can insert it into a Paragraph via a url.