Schrift
[thread]958[/thread]

maximum width size image: How do I set a maximum width size in per



<< >> 6 Einträge, 1 Seite
Gast Gast
 2007-07-10 10:17
#301 #301
Hi,

Do you know how I can add a maximum width size to the picture 'FULLSIZE'. Thanks in advance. Best regards,

Ricardo

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    my(%AD, %FILE, $template,$catlink);
$template = &ParseCommonCodes($TEMPLATE{image});
   %AD = &RetrieveAdDB($FORM{id});
%FILE =

&RetrieveFilesDB($AD{$FORM{file_id}},'[VIEW_URL]');
if($FILE{id}){ $template =~

s/\[FULLSIZE\]/$FILE{code}/iges; }
else{ &
nbsp; $template =~

s/\[FULLSIZE\]//i; }
foreach (keys %FILE){ $template =~

s/\[FILE_$_\]/$FILE{$_}/ig; }
renee
 2007-07-10 10:34
#302 #302
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
What does your template look like? What's in $FILE{code}?
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
DarickY
 2007-07-10 11:03
#303 #303
User since
2007-07-10
2 Artikel
BenutzerIn
[default_avatar]
Sorry for not given all info directly. Perl is new for me. Thanks! Best regards,

Ricardo



Code: (dl )
1
2
3
4
5
6
7
8
9
10
    my($file, $x, $y);
($file)= @_;
open(FILE, "<$file") or return (0,0);
binmode(FILE);
if ($file =~ /jpe?g$/i){ ($x,$y) = &jpegsize(\*FILE); }
elsif($file =~ /\.gif$/i){ ($x,$y) = &gifsize(\*FILE);; }
elsif($file =~ /\.xbm$/i){ ($x,$y) = &xbmsize(\*FILE); }
elsif($file =~ /\.png$/i) {($x,$y) = &pngsize(\*FILE); }
close(FILE);
return ($x,$y);
renee
 2007-07-10 12:46
#304 #304
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Do you want to generate thumbnails or restrict the size with HTML?

If you want to use HTML, you can use the CSS statements "width" and "max-width". The latter is CSS 2.0 and isn't supported by older browsers.

<img src="..." style="width: 350px; max-width: 300px" />

You have to add these information to your template.

If you want to generate thumbnails I would recommend CPAN:GD::Image::Thumbnail and CPAN:Image::Magick::Thumbnail
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
DarickY
 2007-07-10 13:11
#305 #305
User since
2007-07-10
2 Artikel
BenutzerIn
[default_avatar]
I would like to restrict the size by html (or by perl) Unfortunately the code:

Code: (dl )
<img src="..." style="width: 350px; max-width: 300px" />


doesn't work for me because the image is a tag (FULLSIZE) in the html template.\n\n

<!--EDIT|DarickY|1184058709-->
RalphFFM
 2007-07-13 19:19
#306 #306
User since
2006-11-16
258 Artikel
BenutzerIn
[Homepage] [default_avatar]
Perhaps Image::Size (http://search.cpan.org/~rjray/Image-Size-3.01/lib/Image/Size.pm) helps u 2 get 1 step towards ur target?
<< >> 6 Einträge, 1 Seite



View all threads created 2007-07-10 10:17.