Forums / Templates, Stylesheets, Page Layout / Displaying price with use of images

Displaying price with use of images

Locked

Started by mrtorrez on 6 Mar 2007, 4:27 PM · Views: 1,240

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
6 Mar 2007, 4:27 PM
#1
mrtorrez avatar

mrtorrez

New Zenner

Join Date:
Aug 2006
Posts:
74
Plugin Contributions:
0

Displaying price with use of images

Hi,

I want to display prices with use of images instead of plain HTML (CSS).

Is this possible? Maybe use of the GDlibrary and some phpfunctions?

grmx

6 Mar 2007, 6:20 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Displaying price with use of images

Can do - but then not alterable from the admin side and one would have to create another image to manually apply if and when a price change or added product was added

Zen-Venom Get Bitten

6 Mar 2007, 9:04 PM
#3
mrtorrez avatar

mrtorrez

New Zenner

Join Date:
Aug 2006
Posts:
74
Plugin Contributions:
0

Re: Displaying price with use of images

kobra:

Can do - but then not alterable from the admin side and one would have to create another image to manually apply if and when a price change or added product was added

I ment the price on the product-info and the prices on product-index page.
I want those prices dynamically be converted to graphics/images instead.

For example take a look at the price-box on this site:

http://www.thomann.de/gb/yamaha_erg121_gp_ii_bl.htm

grmx

6 Mar 2007, 9:15 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Displaying price with use of images

I want those prices dynamically be converted to graphics/images instead.
No clue how to "Dymanically" convert to images....People in the Desert want Ice Water too!!:lol:

Zen-Venom Get Bitten

6 Mar 2007, 9:19 PM
#5
mrtorrez avatar

mrtorrez

New Zenner

Join Date:
Aug 2006
Posts:
74
Plugin Contributions:
0

Re: Displaying price with use of images

kobra:

No clue how to "Dymanically" convert to images....People in the Desert want Ice Water too!!:lol:

:D
many thanks anyway!

6 Mar 2007, 9:34 PM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Displaying price with use of images

That site has each character in the prices converted to an image. The "2", "3", "8", ".", and "-" are all separate images, as are all the small numbers.

Someone could write a function to take a string and replace it with a group of <img> calls, and then apply it to the price output...

6 Mar 2007, 9:57 PM
#7
mrtorrez avatar

mrtorrez

New Zenner

Join Date:
Aug 2006
Posts:
74
Plugin Contributions:
0

Re: Displaying price with use of images

gjh42:

That site has each character in the prices converted to an image. The "2", "3", "8", ".", and "-" are all separate images, as are all the small numbers.

Someone could write a function to take a string and replace it with a group of <img> calls, and then apply it to the price output...

Yeah, you're right. It's a little bit more complex.

Thanks for triggering!

7 Mar 2007, 1:58 AM
#8
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Displaying price with use of images

Yes and I did not want to get into that but as the subject has been opened - it is akin to remapping a keyboard - a DB lookup table and a mini (numbers and $ . etc)remap of the characters

Zen-Venom Get Bitten

7 Mar 2007, 4:21 AM
#9
outlawlb avatar

outlawlb

New Zenner

Join Date:
Jan 2007
Posts:
86
Plugin Contributions:
0

Re: Displaying price with use of images

I actually had a slightly different idea that is akin to creating dynamic images:

<?php 

header("Content-type: image/jpeg"); 
$string = $_GET['image']; 

$image = imagecreatefrompng("linkto/thebackground/image.gif"); 
$color = imagecolorallocate($image, 255, 255, 250); 
$font = "http://www.yoursite.com/linkto/fontyou/want/to/use.ttf"; 

imagestring($image, $font, 0, 0, $string, $color); 

imagejpeg($image); 
imagedestroy($image); 

?> 
```(I got this from: <http://www.ngxdesigns.com/tutorials/view/?action=view&id=11>)

Now basically you could also do this:

<?php
header
('Content-type: image/png');
$text = $_GET['text'];

$im = imagecreatefrompng COLOR=#007700;

if($text == "ADMINISTRATOR"){ //if administrator
$color = imagecolorallocate($im, 255, 0, 0); //red
}
elseif(
$text == "MODERATOR"){ //if moderator
$color = imagecolorallocate($im, 0, 0, 255); //blue
}
elseif(
$text == "JUNKIE"){ //if junkie
$color = imagecolorallocate($im, 0, 0, 0); //black
}
else {
//something else...
$color = imagecolorallocate($im, 0, 128, 0); //green
}

$font = 'font.ttf'; //font file
$fontsize = 6; //font size
$stringsize = imagettfbbox($fontsize, 0, $font, $text); //calculate the pixel of the string
$dx = (imagesxCOLOR=#007700) - ([/COLOR]absCOLOR=#007700) - [/COLOR]20; //calculate the location to start the text
imagettftext($im, $fontsize, 0, $dx, 13, $color, $font, $text);
imagepngCOLOR=#007700;
[/COLOR]imagedestroyCOLOR=#007700;
[/COLOR]?>
[/COLOR]

">
with 
```
<img src="http://www.yourdomain.com/generator.php?text=JUNKIE" />

```as seen on <http://forum.codecall.net/php-tutorials/1624-php-tutorial-getting-know-gd.html>

But I am unsure to how to cause the admin to take in the price and then display it as such in the products at this time.

I think it would be a combination of taking the product cost variables and its display variables and then just adding the appropriate code.

Would anyone know where this is?
7 Mar 2007, 8:11 AM
#10
mrtorrez avatar

mrtorrez

New Zenner

Join Date:
Aug 2006
Posts:
74
Plugin Contributions:
0

Re: Displaying price with use of images

Maybe we have to look at the zen_get_products_display_price function in

includes/functions/functions_prices.php

This function returns the price

grmx