How to display vendor image file in cakephp .ctp file - cakephp

i have created component secureimage captcha and now i want to display "vendor files audio/refresh.png" file which is placed under vendor/secureimage/images/refresh.png and vendor/secureimage/images/audio_icon.png
code -----------
<object type="application/x-shockwave-flash" data="/adminpanel_login/captcha/securimage_play.swf?bgcol=#ffffff&icon_file=/adminpanel_login/captcha/audio_icon.png&audio_file=<?php echo $captcha_hear;?>" height="32" width="32">
<param name="movie" value="/adminpanel_login/captcha/securimage_play.swf?bgcol=#ffffff&icon_file=/adminpanel_login/captcha/audio_icon.png&audio_file=<?php echo $captcha_hear;?>" />
</object>
<a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('captcha').src ='<?php echo $this->webroot;?>admins/securimage/' + Math.random(); this.blur(); return false"><img src="<?php //echo $captcha_image_refresh;?>/adminpanel_login/captcha/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0" /></a>

You should put images in the webroot, that way they can be served directly by your webserver and not by php.
You can do this by symlinking the image from vendors to webroot/img

Related

How can I get ckeditor to format the html when I view source in Drupal 7

When I edit a page and view the source in a page it does not indent the code.
<p><img alt="" src="/sites/climateactionnow.ca/files/images/Canada-CO2-emissions-2018.png" style="width: 100%;" /></p><p class="rtecenter"><span style="font-size:8px;"><em>Canada per capita CO2e emissions</em></span></p>
Another site shows the source like this
<p><img alt="" src="/sites/climateactionnow.ca/files/images/Canada-CO2-emissions-2018.png" style="width: 100%;" /></p>
<p class="rtecenter"><span style="font-size:8px;"><em>Canada per capita CO2e emissions</em></span></p>
How can I fix this?

Angularjs - set value ng-click inside ng-repeat on an item

I load quite a few videos on the page, from youtube. I want to replace the div with placeholder, and only request the video when user clicks on the placeholder image.
I got this part working where it loads the video on ng-click, but it loads all of them, obviously. How do I load just the one that was clicked?
Here's my html inside ng-view and ng-repeat:
<figure class=" img-responsive">
<iframe width="320" height="180" ng-src="{{item.VideoUrl | trusted }}"
frameborder="0" allowfullscreen="false" autoplay="0" ng-if="doplay">
</iframe>
<img ng-src="images/logos/videoplaceholder.jpeg" height="180"
class="img-responsive" ng-if="!doplay" ng-click="setPlay()" />
</figure>
<script>
$scope.setPlay = function (){
$scope.doplay = true;
}
</script>
Like I said, the above works, but loads all the videos at once. I need to load just the one that was clicked. Thanks!!
I don't see your ngRepeat, but the simplest way is something like this:
<figure class="img-responsive" ng-repeat="item in items">
<iframe width="320" height="180" ng-src="{{item.VideoUrl | trusted }}" frameborder="0" allowfullscreen="false" autoplay="0" ng-if="item.doplay"></iframe>
<img ng-src="images/logos/videoplaceholder.jpeg" height="180" class="img-responsive" ng-if="!item.doplay" ng-click="item.doplay = true" />
</figure>
and skip the controller method. That just sets a property on each item in your collection.
Your doplay property only contains one value, so the ng-if condition is the same for every video. You might be able to get away without adding the doplay property to item in advance, since if it's not present it will be falsey.
So your code would change to:
<img ng-src="images/logos/videoplaceholder.jpeg" height="180" class="img-responsive" ng-if="! item.doplay" ng-click="setPlay(item)" />
and
$scope.setPlay = function (item)
{
item.doplay = true;
}

string URLs of images in the database and don't show image in jsp file

I use MySql database. There are string url of images in database.I want to show images in jsp file but I can't. My code is here.
<c:forEach var="urun" items="${listUrun.rows}">
<tr>
<td><c:out value="${urun.kitapresim}" /></td>
<img src="<c:url value="${urun.kitapresim}" /> " width="270" height="190"/>
Jsp file looks like it .
http://i.hizliresim.com/Ez6dM8.png
How I solved it?
You have double quotation here
<img src="<c:url value="${urun.kitapresim}" /> " width="270" height="190"/>
replace it with ''
<img src="<c:url value='${urun.kitapresim}' /> " width="270" height="190"/>
or escape it.
<img src="<c:url value=\"${urun.kitapresim}\" /> " width="270" height="190"/>

Richface popup not working in GAE

Base on example from richface showcase:
http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=popup&sample=simplePopup&skin=blueSky
When I call the popup using #{rich:component, nothing happen (ie. no popup):
<a4j:commandLink styleClass="no-decor" execute="#this"
oncomplete="#{rich:component('popup')}.show()">
However when I change to using rich:componentControl, popup appear
<a4j:commandLink styleClass="no-decor" execute="#this">
<rich:componentControl target="popup" operation="show" />
Note: Both work find from GAE when I run from my local notebook but problem happen when I deploy to GAE online (http://cloudenterpriseapps.appspot.com/public/test/testPopup.jsf)
Any help?
Just solved by adding
<a4j:status onstart="#{rich:component('statPane')}.show()"
onstop="#{rich:component('statPane')}.hide()" />
...
<rich:popupPanel id="statPane" autosized="true">
<h:graphicImage value="/images/common/ai.gif" alt="ai" />
Please wait...
</rich:popupPanel>
Here the complete code and now work fine.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<ui:composition>
<h:head>
<title>RichFaces Showcase</title>
</h:head>
<h:body>
<a4j:status onstart="#{rich:component('statPane')}.show()"
onstop="#{rich:component('statPane')}.hide()" />
<a4j:commandLink styleClass="no-decor" execute="#this" render="#none"
action="#{dummyBean.methodCall}"
oncomplete="#{rich:component('popup')}.show()">
<h:graphicImage value="/images/icons/common/edit.gif" alt="edit" />
</a4j:commandLink>
<h:form id="myform">
<rich:popupPanel id="popup" modal="false" autosized="true"
resizeable="false">
<f:facet name="header">
<h:outputText value="Simple popup panel" />
</f:facet>
<f:facet name="controls">
<h:outputLink value="#"
onclick="#{rich:component('popup')}.hide(); return false;">
X
</h:outputLink>
</f:facet>
<p>Any content might be inside this panel.</p>
<p>
The popup panel is open and closed from the javascript function of
component client side object. The following code <a href="#"
onclick="#{rich:component('popup')}.hide()">hide this panel</a>:
<f:verbatim>#</f:verbatim>
{rich:component('popup')}.hide()
</p>
<a4j:commandButton value="Close" styleClass="no-decor"
execute="#this" render="#none" action="#{dummyBean.methodCall2}"
oncomplete="#{rich:component('popup')}.hide()"/>
<br />
</rich:popupPanel>
</h:form>
<rich:popupPanel id="statPane" autosized="true">
<h:graphicImage value="/images/common/ai.gif" alt="ai" />
Please wait...
</rich:popupPanel>
</h:body>
</ui:composition>
</html>

How do I embed a Silverlight control into a Facelets page?

I am trying to embed a Silverlight control into a JSF 2.0 page, which is using Facelets, however, I am receiving a very ambiguous error message when the page renders.
Can anyone suggest how I can do this? I have my clientaccesspolicy.xml, and silverlight.js in place.
When I remove the <object> tag, the JSF page displays correctly
If I place the <object> tag into a vanilla HTML page, the silverlight control renders correctly in my Tomcat 7.0.25.
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:cayman="http://www.fnet.com/cayman/jsf"
template="/WEB-INF/jsf/template.xhtml">
<ui:define name="title">Home Page</ui:define>
<ui:define name="content">
<h:form>
<ui:include src="header.xhtml">
<ui:param name="loginBean" value="#{UserLoginComponent}" />
</ui:include>
<div>
<p:growl />
</div>
<center>
<p:panel header="Home Page">
<f:verbatim escape="#{true}">
<object data="data:application/x-silverlight-2,"
type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="Dashboard.xap" />
<a
href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0"
style="text-decoration: none"> <img
src="http://go.microsoft.com/fwlink/?LinkId=161376"
alt="Get Microsoft Silverlight" style="border-style: none" />
</a>
</object>
</f:verbatim>
<iframe id="_sl_historyFrame"
style="visibility: hidden; height: 0px; width: 0px; border: 0px"></iframe>
<h:inputHidden id="userid" value="ADMINISTRATOR" />
<h:inputHidden id="password" value="admin" />
<h:inputHidden id="adminserviceuurl"
value="http://129.196.218.35:8080/cayman/services" />
</p:panel>
</center>
</h:form>
</ui:define>
Remove <f:verbatim>. It's a leftover from the old ages of JSF 1.x on JSP and deprecated in JSF 2.x.
As to the ambiguous error message which you forgot to include in your question, make sure that you're properly escaping XML special characters like &. Facelets is a XML based view technology and will be parsed by a XML parser before generating the HTML. The XML parser will choke when it encounters & which is supposed to represent the start of an entity, but there is no ; to denote the end of an entity or when the entity by itself does not represent anything at all.
So, replace
href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0"
by
href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0"

Resources