21293 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1628 Views |
-
image.php - getTag , title problems

21 January 2010 at 1:30am Last edited: 21 January 2010 1:34am
Hello,
i hope this is the right place for my question/problem. I have searched for the problem, buf havent found anything therefor.
to the problem :
whenever an image gets resized, the $title will be empty (also for any other file $db ).image.php // 2.3.4.
function getTag() {
if(file_exists("../" . $this->Filename)) {
$url = $this->URL();
$title = ($this->Title) ? $this->Title : $this->Filename;
return "<img src=\"$url\" alt=\"$title\" />";
}
}when i call an image in the template with $image.setWidth(width:px), $title will get the Filename.
If its simple called with $image in the template, the correct title will be shown.
Well, anyone has an idea, how the correct $title can be accessed ?
(Also how i can make changes to File.php,Image.php effects it outside the sapphire folder? for easier maintenance with an update)
the goal would be something like that:
return "<img src=\"$url\" alt=\"$title\" title=\"$MyFileDescription\" />";
-
Re: image.php - getTag , title problems

21 January 2010 at 8:54am
Hi AlknicTeos!
Wich "Title" would you like to show? Title of the page... or the name of the image file?
If you want to show Title of current page, you can put this code (I don't know if it's the right way but it works for me
)
<% control Image %>
<% control SetWidth(100) %>
<img src="$URL"
<% end_control %>
<% end_control %>
alt="$Title" /> -
Re: image.php - getTag , title problems

21 January 2010 at 9:41pm Last edited: 21 January 2010 10:00pm
Well, i actually dont want the page title, but the file title.
Also its nice to see how controls can be used, there is still the same problem
<% control Image %>
<% control SetWidth(100) %>
<img src="$URL" alt="$Title" />
<% end_control %>
<% end_control %><% control Image %>
<img src="$URL" alt="$Title" />
<% end_control %>you will see the difference again. in the first case the $title will be empty and in the second, the $title of the file.
I want to access the db in
file.php
static $db = array(
"Name" => "Varchar(255)",
"Title" => "Varchar(255)",
"Filename" => "Varchar(255)",
"Content" => "Text",
"Sort" => "Int"
);... for even resized images. Is it easily possible to get the original Filename of a resized image?
Thanks juandavidgc, maybe anyone else has another idea ?
-
Re: image.php - getTag , title problems

8 February 2010 at 10:27pm Last edited: 8 February 2010 10:27pm
I had the same problem and the partial solution above brought me to the following:
<% control Newspic %>
<% control SetWidth(150) %><img src="$URL" <% end_control %> alt="$Title" />
<% end_control %>Works fine for me.
-
Re: image.php - getTag , title problems

1 October 2010 at 7:28am
I have not tested, but I believe this should work:
<% control Image %>
<% control SetWidth(100) %>
<img src="$URL" alt="$Top.Title" />
<% end_control %>
<% end_control %>One thing is that you 'should' get the title from the non-resized image, this may or may not work for you.
| 1628 Views | ||
|
Page:
1
|
Go to Top |


