Image Widget - show large image in fancybox style

Posted by Community Admin on 04-Aug-2018 16:56

Image Widget - show large image in fancybox style

All Replies

Posted by Community Admin on 19-Dec-2012 00:00

First I must thank Jochem once again for pushing me to finally try to make my own solution.

Here we go. screencast http://www.marktold.com/screencast/fancybox_images.swf

I think the image widgets option to show an image in original size is cool. However having it open as a new blank window like in 1998 is a bit embarrassing.

Here is my solution I would like to share.

1) I downloaded fancybox version 2.1.3 from here http://fancyapps.com/fancybox/#license
2) Extracted the files and included the files in my own project.  I have a root folder MyResources where I have some general stuff. Split in images, scripts, styles -> so I had to change jquery.fancybox.css (css_changes.png) image pathes to my own hierarchie. -> MyResources.png
3) created fancybox.ascx with the following code

Had to add it as image - code paging got me an invalid code error on this editor sorry :-(

code.png

4) build my project and uploaded the whole stuff.
5) In the backend Admin - Settings - Advanced - Toolboxes  I have my own section where I add the fancybox.ascx (add_ascx.png)
6) now a client can select an image widget, choose to have original size shown and drag the fancybox.ascx widget to the page. I dragged it to the bottom of the page.

So now when clicked the images should open in fancybox style.

Markus

PS: Tried it first on master.master but then the sitefnity gallery would no longer work :-( so therefore this (might be clumsy) approach. 

Seems to work so far. Looking for feedback.

Markus


PS: Wished the image widget would do this automatically.

Posted by Community Admin on 19-Dec-2012 00:00

Here is the code. It worked when I split the code. Maybe it was just an hickup :-O

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="fancybox.ascx.cs" Inherits="SitefinityWebApp.UserControls.fancybox" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>


<!-- Add jQuery library -->
<script type="text/javascript" src="/MyResources/scripts/jquery-1.8.3.min.js"></script>
 
<!-- Add mousewheel plugin (this is optional) -->
<script type="text/javascript" src="/MyResources/scripts/jquery.mousewheel-3.0.6.pack.js"></script>
 
<!-- Add fancyBox -->
<link rel="stylesheet" href="/MyResources/styles/jquery.fancybox.css?v=2.1.3" type="text/css" media="screen" />
<script type="text/javascript" src="/MyResources/scripts/jquery.fancybox.pack.js?v=2.1.3"></script>
 
    <script type="text/javascript">
        $(document).ready(function ()
            $(".sfimageWrp a").fancybox();
        );
    </script>

Markus

PS: Please not that version 2 of the linked fancybox is NOT free for commercial use.

Posted by Community Admin on 24-Dec-2012 00:00

Hello Markus,

Thank you for the code and the video that you shared with us!

" ... having it open as a new blank window like in 1998 is a bit embarrassing." - true! The image widget and especially in combination with the fancy-box library is implemented long time ago in Sitefinity and unfortunately haven't been changed or updated so far.

However as your code includes a change in the fancy-box version (which you mentioned is not free) we should discuss whether and when we will upgrade and then we can benefit from your solution.

Thank you once again! Your Telerik points have been updated as a token of gratitude!

Regards,
Veronica Milcheva
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 24-Dec-2012 00:00

Dear Veronica

I guess it should not be to hard for you guys to come up with as a solution using the old already in SF integrated fancybox version.

<sf:resourcelinks id="ResourceLinks1" runat="server">
       <sf:ResourceFile Name="Telerik.Sitefinity.Resources.Scripts.jquery.fancybox-1.3.1.js" />
   </sf:resourcelinks>


<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="fancybox.ascx.cs" Inherits="SitefinityWebApp.UserControls.fancybox" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
<!-- Add jQuery library -->
<script type="text/javascript" src="/MyResources/scripts/jquery-1.8.3.min.js"></script>
 
<%--<!-- Add mousewheel plugin (this is optional) -->
<script type="text/javascript" src="/MyResources/scripts/jquery.mousewheel-3.0.6.pack.js"></script>--%>
 
<!-- Add fancyBox -->
<%--<link rel="stylesheet" href="/MyResources/styles/jquery.fancybox.css?v=2.1.3" type="text/css" media="screen" />
<script type="text/javascript" src="/MyResources/scripts/jquery.fancybox.pack.js?v=2.1.3"></script>--%>
 
<link href="/MyResources/styles/jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css" />
<script src="/MyResources/scripts/jquery.fancybox-1.3.4.js" type="text/javascript"></script>
 
    <script type="text/javascript">
        $(document).ready(function ()
            $(".sfimageWrp a").fancybox();
        );
    </script>

Thank's for the points. I did not know they still existed.

Markus

Posted by Community Admin on 20-Feb-2013 00:00

In my post from 19th December I wrote:

QUOTE
PS: Please not that version 2 of the linked fancybox is NOT free for commercial use.
UNQUOTE

Can Telerik confirm that you cover the license since you are using version 2 now!!!!

Markus

Posted by Community Admin on 20-Feb-2013 00:00

This is my updated code I use now:

In the head of my .master

<sf:ResourceLinks ID="resourcesLinks" runat="server">
       <sf:ResourceFile JavaScriptLibrary="JQuery" />
       <sf:ResourceFile Name="Telerik.Sitefinity.Resources.Scripts.jquery.fancybox.pack.v2.1.3.js" />
   </sf:ResourceLinks>

My fancybox.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="fancybox.ascx.cs" Inherits="SitefinityWebApp.UserControls.fancybox" %>
 
<link href="/MyResources/styles/jquery.fancybox-2.1.3.css" rel="stylesheet" type="text/css" />
 
    <script type="text/javascript">
        $(document).ready(function ()
            $(".sfimageWrp a").fancybox();
        );
    </script>

Of course you need the .css  

Markus

PS: Still looking forward to the Telerik answer concerning the license

Posted by Community Admin on 25-Feb-2013 00:00

Hello Markus,

i can confirm that we're using Fancybox v2.1.3 in 5.4, but I'm not sure what you mean by "confirm that you cover the license". Can you elaborate a bit please?

All the best,
Jen Peleva
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 25-Feb-2013 00:00

Dear Jen

How about looking at the image I attached in my last post sf_fancybox or here: fancyapps.com/.../

Markus

 

 

Posted by Community Admin on 01-Mar-2013 00:00

@Telerik

Any news if the license is covered if we use Sitefintiy or do we have to buy our own license!

This is important!!

Markus

Posted by Community Admin on 04-Mar-2013 00:00

Hello Markus,

We have bought a license, of course.
We'll switch back to the old version tough - we've received a lot of complaints with this version so far.

Regards,
Georgi
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 04-Mar-2013 00:00

Dear Georgi

Thanks's for the information. I assume a license for all users of Sitefinity, right.

Will the switch back be in 6.0? 

Markus

Posted by Community Admin on 04-Mar-2013 00:00

Hello,

Yes. We'll switch back to the old one in 6.0, plus we'll fix any known issues with it with the switch. 

Kind regards,
Georgi
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed