Page 1 of 1

iPhone max_image_height

PostPosted: Tue Jun 22, 2010 7:44 am
by playadz
Hi,

I was wondering why the iphone max_image_height property was set to 480px which is actually the size of the screen.

I was more hoping something smaller considering the height of the bottom bar.

Anyway, I'm sure there's a really good reason for this :-) so, what if I want to patch my tera wurfl database to modify this specific property, how should I procede.

Thanks!!

Re: iPhone max_image_height

PostPosted: Tue Jun 22, 2010 4:12 pm
by kamermans
Hi playadz, I agree with your assessment of the iPhone height (and width), however, there was some debate about this on the WURFL mailing list and eventually they decided to use the width and height that we have now. In order to use a patch file to override these settings, you can use something like this:

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<wurfl_patch>
   <devices>
      <device user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A538a Safari/419.3" fall_back="apple_generic" id="apple_iphone_ver1">
         <group id="display">
            <capability name="max_image_width" value="xxx"/>
            <capability name="max_image_height" value="xxx"/>
         </group>
      </device>
      <device user_agent="Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3" fall_back="apple_generic" id="apple_ipod_touch_ver1">
         <group id="display">
            <capability name="max_image_width" value="xxx"/>
            <capability name="max_image_height" value="xxx"/>
         </group>
      </device>
   </devices>
</wurfl_patch>


I put the iPhone and the iPod in the patch file since you probably want to affect both of them.
Here's how to get it working:

  1. Change the xxx to the width/height that you want to use.
  2. Copy the text and paste it into a text file and call it something like override_patch.xml and upload it to the Tera-WURFL data/ directory.
  3. Edit TeraWurflConfig.php and find the PATCH_FILE directive. Put your filename (override_patch.xml) at the end of the list of files so Tera-WURFL will load it.
  4. Go to the admin page and reload the WURFL file. This will load your patch file and use it to override the settings in the WURFL file.

Re: iPhone max_image_height

PostPosted: Wed Jun 23, 2010 3:28 am
by playadz
Than you so much for this.

I still have another question, is it possible to make this changes available for ALL user_agents that corresponds to iPhone, because if I understand well, this will only work for iphone which have those user agents. (I'm pretty sure the user agent will be different if the service provider is Orange or Bouygues)

Thank you!

Re: iPhone max_image_height

PostPosted: Wed Jun 23, 2010 11:45 am
by kamermans
No problem! Because of the way the WURFL works, all iPod Touch and iPhone devices will inherit their base capabilities (like max_image_height) from their root WURFL device. This is represented in the WURFL as devices with the _ver1 suffix (i.e. apple_ipod_touch_ver1). Long story short - this patch should affect all iPods and iPhones.

Re: iPhone max_image_height

PostPosted: Thu Jun 24, 2010 7:07 am
by playadz
Hi,
thank you for your quick answer but I don't manage to make it work.

I loaded the following patch file in my tera wurfl database

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<wurfl_patch>
   <devices>
      <device user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A538a Safari/419.3" fall_back="apple_generic" id="apple_iphone_ver1">
         <group id="display">
            <capability name="max_image_width" value="320"/>
            <capability name="max_image_height" value="420"/>
         </group>
      </device>
      <device user_agent="Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3" fall_back="apple_generic" id="apple_ipod_touch_ver1">
         <group id="display">
            <capability name="max_image_width" value="320"/>
            <capability name="max_image_height" value="420"/>
         </group>
      </device>
      <device user_agent="Mozilla/5.0 (Linux; U; Android 2.1-update1; xx-xx; HTC Desire Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17" fall_back="htc_desire_a8181_ver1" id="htc_desire_ver1">
         <group id="display">
            <capability name="max_image_width" value="460"/>
            <capability name="max_image_height" value="620"/>
         </group>
      </device>
    </devices>
</wurfl_patch>


Then I rebuilt the cache and tried it on my server with the following user agents

Code: Select all
Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A538a Safari/419.3
which is the one from the apple_iphone_ver1 device is OK and I can see the changes on the max_image_height

Code: Select all
Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_3 like Mac OS X; xx-xx) AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7E18
which is the one of my co-worker. The device detected is apple_iphone_ver3_1_3_subenus and the height is still 480 instead of 420.

Indeed, when I check in the database, I can see thet the capabilities of this particular device is still 480.

So, what am I doing wrong?
- is the merge supposed to rebuild every capability on each iphone device
- or do I have to modify all iphones devices in a patch file (which is not really possible)

Thanks again!!

Re: iPhone max_image_height

PostPosted: Mon Jun 28, 2010 2:44 am
by playadz
up

Re: iPhone max_image_height

PostPosted: Thu Jul 01, 2010 2:38 am
by playadz
up

Re: iPhone max_image_height

PostPosted: Fri Jul 02, 2010 9:21 am
by kamermans
Sorry about the delayed response - the solution I posted should have worked as I explained, but since it didn't, there must be a problem with the actual WURFL data (one of the other iPhone device entries is overriding the max_image_width). I have put this on my list of priorities for today.

Re: iPhone max_image_height

PostPosted: Fri Jul 02, 2010 11:52 am
by kamermans
Ok, the situation is not as bad as I thought. In fact it's a little better :) It turns out that the iPod Touch get's it's max_image_* from the iPhone, so that entry is unnecessary. What we need to do is set the max_image_* properties for the apple_iphone_ver2, which is where many of the iPhones get their settings from. This patch should take care of all iPhones and iPod Touches:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<wurfl_patch>
   <devices>
      <device user_agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A538a Safari/419.3" fall_back="apple_generic" id="apple_iphone_ver1">
         <group id="display">
            <capability name="max_image_width" value="320"/>
            <capability name="max_image_height" value="420"/>
         </group>
      </device>
      <device user_agent="Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_0 like Mac OS X; xx-xx) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5A345 Safari/525.20" fall_back="apple_iphone_ver1" id="apple_iphone_ver2">
         <group id="display">
            <capability name="max_image_width" value="320"/>
            <capability name="max_image_height" value="420"/>
         </group>
      </device>
      <device user_agent="Mozilla/5.0 (Linux; U; Android 2.1-update1; xx-xx; HTC Desire Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17" fall_back="htc_desire_a8181_ver1" id="htc_desire_ver1">
         <group id="display">
            <capability name="max_image_width" value="460"/>
            <capability name="max_image_height" value="620"/>
         </group>
      </device>
    </devices>
</wurfl_patch>