typo3 7: link image (if link is defined) - php

I am trying to output an image assigned to an extbase entity named "course" in a fluid template. This works fine, except I just don't know how to get the correct link if an image link was defined. What I tried is this:
<f:link.page pageUid="{course.image.originalResource.link}">
<f:image image="{course.image}"/>
</f:link.page>
This works, except when I define a target in the backend this is completely ignored - is there a different way aside from f:link.page or how can I link an image?

Starting from TYPO3 7.4 you can use typolink
<f:link.typolink parameter="{link}" target="_blank" class="ico-class" title="some title" additionalParams="&u=b" additionalAttributes="{type:'button'}">
Linktext
</f:link.typolink>

Related

Wordpress seems to be suppressing img title attribute

I am using a modified version of ContentFlow in Wordpress 3.9.1 . ContentFlow is a coverflow tool that generates a coverflow from a series of tags and their caption is created from the title=""-attribute.
I have a piece of php code that gets included to individual posts/pages via a template file and the insert php plugin, which runs just fine. It creates img tags that look like this:
<img class="item" src="http://www.path-to-the-image.com/001.jpg" href="http://www.path-to-the-image.com/001.jpg" title="001" id="" />
This all works fine. But when I let wordpress execute the script and render the image I get this:
<img class="item" src="http://www.path-to-the-image.com/001.jpg" href="http://www.path-to-the-image.com/001.jpg" id="">
As you can see the title tag is missing. And it seems to be specifically title tags. If I rename the title tag in php to e.g. "testtitle" I get flawlessly
<img class="item" src="http://www.path-to-the-image.com/001.jpg" href="http://www.path-to-the-image.com/001.jpg" testtitle="001" id="" />
So it seems Wordpress is suppressing the title tag by force. I have no plugins that should do this. Any ideas where the tag goes missing?
I have another installation running on the same server that does not have this issue, also running Wordpress 3.9.1
I found this on wordpress.org:
IMG Title Restore
WordPress 3.5 introduced a new feature – when images are inserted into posts, the title attribute is not included in the image tag. This was done with the best of intentions relating to accessibility, as documented on Trac
Unfortunately, this causes problems for some Lightbox plugins, quite apart from stopping image tooltips from appearing.
This plugin hooks into the media_send_to_editor filter and inserts the image title into the html inserted into the post.

Link Article title to a PDF file in joomla

I am using joomla 1.5 and looking out for Article Title is linkable and link goes to a pdf file. I am able to make Article Title Linkable but doesn't able to link it to a pdf file.
Is there any way to customise PDF Icon link?
Is there any way to do it? Any help appriciated.
You're probably aware that Joomla 1.5 is "End-of-Life" and no longer being maintained and presents a security issue and really should be upgraded to at least the Long Term Support 2.5 line if not the current Short Term Support 3.1 release.
In fact 1.5 is now at the point where extensions are no longer listed in the Joomla Extension Directory for it, and new 1.5 extensions are not being accepted.
You'll need to look in the PDF & Print section of the Archived Extensions Directory
Your question implies that using the standard PDF button in Joomla 1.5 isn't suitable for you either. (Don't forget that there are issues with the built-in PDF functions on older browsers.)
If you can't find a suitable extension then you will need to create a output override in your template directory for each of the content views that you want to modify. It's a trivial exercise to change the title in the article default tmpl file (i.e. com_content/views/article/tmpl/default.php) so that it's wrapped in a URL that points to the PDF version of the view.
The PDF link is simply the same as the article link except it uses the PDF format, e.g.
index.php?view=article&catid=1&id=45&format=pdf
So, if you're overriding the default output (i.e. the template you're using doesn't already have an override) you'll want the line where the page title is echo'd to change from:
<a href="<?php echo $this->article->readmore_link; ?>" class="contentpagetitle<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<?php echo $this->escape($this->article->title); ?></a>
to:
<a href="<?php echo JRoute::_('index.php?view=article&catid=' . $this->article->catid . '&id=' . $this->article->id . '&format=pdf'); ?>" class="contentpagetitle<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<?php echo $this->escape($this->article->title); ?></a>
It's worth considering that this means every article title will generate a PDF, this may confuse users. The link as it stands will also cause your websites page to be replaced with the PDF, you may want to add a target="_blank" to it so a new window/tab with the PDF is created.

openTBS remove image when replace not found

How do you remove the image in OpenTBS if the one you are replacing it with does not exist?
I have a bit of code that loops through and replaces pics in a table, but sometimes the client will not have the pictures. I tried leaving out the default=current tag but it shows a missing image box("This image cannot currently be displayed").
UPDATE:
I thought Skrols answer would work but I couldnt get it to work. I have an image followed by the following tag.
[field.p5;ope=changepic;from=’[val]’;adjust]
Whats tags following this would i have to use to say if the field variable p5 is not set or empty ect then remove the image.
If your first need is to not change the picture in the Docx if the target picture is a not found file, then they are two solutions:
First try with the latest OpenTBS version (1.7.4) because it claims to fix a bug about "default=current"
If it does not work, then you have to check at the PHP side if the target picture does exist using file_exists(). If it doesn't exist then change the target picture path with a new file that you are sure it does exist.
If you prefer to delete the picture box in the document if the file is missing, then you can add a TBS field that will delete the picture box depending to a global variable.
PHP:
$picok = (file_exists($the_picture)) ? 1 : 0;
HTML:
[onshow;block=w:drawing;when [var.picok]=1]

link with same url in php

I have some thumbnail images with its larger version.I placed the thumbnail images in a page.Now for link I just gave a link
<img src="thumbnail1.jpg>
but for this I have to make different pages for showing larger one.I want to give a link to show them in a single page.means whenever I will click the thumbnail it will open the larger one in a page with the same url but with its name like
imagegallery.php?news=images/largerimage1/13.jpg
imagegallery.php?news=images/largerimage1/14.jpg
so how to do that?
Pretty basic stuff, I suggest you get to read some PHP tutorials on the internet to get some knowledge on one thing and another.
The ?news= part in your URL is a parameter that can be read by PHP. This type is known as $_GET. To get this part you would need $_GET['news'] so if we'd use your first link and place this inside a script: echo $_GET['news']; the page would say images/largerimages1/13.jpg.
In order to get the image loaded on your website we need some simple steps, I'm changing the news parameter into image, that suits better for your script since it ain't news items:
<?php
// Define the path (used to see if an image exists)
$path = 'your/absolute/path/to/public_html/'; # or wwwroot or www folder
// First check if the parameter is not empty
if($_GET['image'] != "") {
// Then check if the file is valid
if(file_exists($path . $_GET['image'])) {
// If an image exists then display image
echo '<img src="'. $_GET['image'] . '" />;
}
}
?>
Below this script you can put all your thumbnails the way you want. Ofcourse, also for these thumbnails there are some automated options. But I strongly suggest you get a good look at the script above and some beginner PHP tutorials so you completely understand the example given. This still isn't the best method, but it's kicking you in the right direction.
if your imagegallery.php is in root of your domain, you can just add slash as a first char to links like this:
<img src="thumbnail1.jpg>
else you will have to write some php function which it returns BaseUrl of your web. Then it should looks like this:
<img src="thumbnail1.jpg>
maybe you can something like this,
Techincally, there is no thumbnail image, just a stretch version of the regular image
I don't understand which part you don't know how to do:
- the link part?
it should look like
<img src="thumbnail1.jpg>
- or the PHP part (the file called imagegallery.php)?

Lightbox image / link URL

Basically I have a slightly non-standard implementation of FancyBox. By default you have to include a link to the large version of the image so that the Lightbox can display it. However, in my implementation, the image link URLs point to a script rather than directly to the image file. So for example, instead of:
<a href="mysite/images/myimage.jpg" rel="gallery">
I have:
<a href="mysite/photos/view/abc123" rel="gallery">
The above URL points to a function:
public function actionPhotos($view)
{
$photo=Photo::model()->find('name=:name', array(':name'=>$view));
if(!empty($photo))
{
$this->renderPartial('_photo', array('photo'=>$photo, true));
}
}
The "$this->renderPartial()" bit simply calls a layout file which includes a standard HTML tag to output.
Now when the user clicks on a thumbnail, the above function is called and the large image is displayed in the Lightbox.
Now if the user right clicks on the thumbnail and selects "open in new tab/window" then the image is displayed in the browser as per normal, i.e. just the image. I want to change this so that it displays the image within a layout.
In the above code I can include the following and put it in an IF statement:
$this->render('photos', array('photo'=>$photo));
This will call the layout file "photos" which contains the layout to display the image in.
I have a specific limitation for this - the image URL must remain the same, i.e. no additional GET variables in the URL. However if we can pass in a GET variable in the background then that is OK.
I will most likely need to change my function above so that it calls a different file for this functionality.
EDIT: To demonstrate exactly what I am trying to do, check out the following:
http://www.starnow.co.uk/KimberleyMarren
Go to the photos tab and hover over a thumbnail - note the URL. Click the thumbnail and it will open up in the Lightbox. Next right click on that same thumbnail and select "open in new tab/new window". You will notice that the image is now displayed in a layout. So that same URL is used for displaying the image in the Lightbox and on its own page.
The way StarNow have done this is using some crazy long JavaScript functionality, which I'm not too keen on replicating.
The html link should point to the layout showing the image on a new page by default, e.g.:
<a href="mysite/images/show/123" rel="gallery">
Before the lightbox opens, append a query string to the url in order to distinguish it from the normal link and load the layout for the lightbox. As soon as the image is loaded in the lightbox, change the link back to its original state.
$("a[rel=gallery]").fancybox({
'onStart': function (selectedArray, selectedIndex, selectedOpts) {
var el = $(selectedArray[selectedIndex]);
el.attr('href', el.attr('href') + '?mode=lightbox');
},
'onComplete': function (currentArray, currentIndex, currentOpts) {
var el = $(currentArray[currentIndex]);
el.attr('href', el.attr('href').split("?")[0]);
}
});
You will then have to process the following link in order to return the lightbox layout:
<a href="mysite/images/show/123?mode=lightbox" rel="gallery">
You should be able to modify the JavaScript function that generates the HTML with the <img /> tag to link the image to such a page. Although, if you are trying to make it so that selecting "Open image in new tab" opens a page like this, then that might be impossible (unless there is some sort of crazy cookie/session implementation to alternate between the image script just passing an image and generating a page, which I think could be possible). To assign a new href for the link to have when you click "Open link in new tab" should be quite possible by just modifying the JavaScript function.
Could you clarify what exactly you are attempting to do? Open link in new tab or open image in new tab?
Edit: It appears that the FancyBox script is changing the href of your link to point directly to the image. You would need to find where in the script it is selecting each link tag with rel="gallery" and replacing the href to point to the images; you will want it to not change the href if you want it left as "mysite/photos/view/abc123", for example.
If you need the same functionality the demo site you posted is using, then this is easy to achieve, but keep in mind that the site is NOT using the same URL for both the pop-up and the standalone image page.
Click on any thumbnail with Firebug console is open, you'll notice that it's making an Ajax request to get the image from a different URL! which is an obvious behavior.
http://www.starnow.co.uk/profile/PhotosTrackView.aspx?photo_id=2129864
While the link is pointing to:
http://www.starnow.co.uk/KimberleyMarren/photos/2129864/
you see your links should point to the correct image page, in case of JS disabled browsing or right clicking (as you mentioned) AND using JS to override the link default behavior (which is redirecting you to the image page).
So for example you can have a method that will generate your image layout/page, and this should be used as href; and override the click event of the link to call a similar method (using ajax) but this time it'll retrieve the image itself to use it in your lightbox.

Categories