We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

New plugin : IMG Tag Modifier - to modify inline image tags

Development and Programming

sambo's avatar
sambo
80 posts
17 years ago
sambo's avatar sambo

Wild guess. Try the parse=”inward” on the sql plugin.

       
sambo's avatar
sambo
80 posts
17 years ago
sambo's avatar sambo

Maybe I need to understand better what you are trying to do. You have a path to an image and are trying to use the plugin to create a new img tag based on your parameters?

The plugin will only do something if it finds an img tag. Maybe you could put your image path into a img tag and see what happens.

{exp:Shj_imgmodifier phpthumb="true" phpthumb_path="/thumb/phpThumb.php" phpthumb_attributes="q=50&zc=1" width="100" height="100" lightbox="false"}
{image}
{/exp:Shj_imgmodifier}
       
ErwinVanLun's avatar
ErwinVanLun
235 posts
17 years ago
ErwinVanLun's avatar ErwinVanLun

Optimised the test page:

[code}Just Image:

{image}

XMP code :

<xmp>{image}</xmp>

XMP code with ee_typography:

<xmp>{exp:ee_typography allow_image_urls="y"}{ image}{/exp:ee_typography}</xmp>

{exp:shj_imgmodifier phpthumb="true" phpthumb_path="/thumb/phpThumb.php" phpthumb_attributes="q=50&zc=1" width="420" lightbox="false" clear="true" parse="inward"} Modified image with ee_typography:

{exp:ee_typography allow_image_urls="y"}{ image}{/exp:ee_typography}

Modified image without ee_typography:

{image}

{/exp:shj_imgmodifier}

{/exp:query}

</code></pre>

On top, I have added a parameter to the ee_typography tag to allow for image URL’s. As you can see in the XMP statement, it parses fine. You can try one of the images and see that they exist. However, no images show up :-(. I really don’t know what could be the problem. Maybe a night of sleep will help…

       
ErwinVanLun's avatar
ErwinVanLun
235 posts
17 years ago
ErwinVanLun's avatar ErwinVanLun

I have tried your suggestions but also the parse inward on the SQL statement don’t work.

But browsing, browsing, browsing, I have found this solution:

http://ellislab.com/forums/viewthread/56324/ by Sue.

Which just says: define a global var filedir_5 (in my case). This works! It is not the solution which will get an EE innovation award, but it works… And as the deadline is approaching very fast, I am really happy right now.

thanks for all your support!

Erwin

       
sambo's avatar
sambo
80 posts
17 years ago
sambo's avatar sambo

Great. I am really glad that you have a solution.

Good luck with your deadline.

       
ErwinVanLun's avatar
ErwinVanLun
235 posts
17 years ago
ErwinVanLun's avatar ErwinVanLun

Hi Sambo,

Found a bug in your plugin shj_imgmodifier. Should I report this here or in bug forum?

The bug occur when an author inserts an image from another domain. It leads to a PHP error: division by zero error. Actually, no picture should be returned.

Erwin

       
sambo's avatar
sambo
80 posts
17 years ago
sambo's avatar sambo

Hi

Thank you for reporting it. You should do it here. I will look into this.

I suspect that the problem is some settings in PHPThumb. The plugin just finds img tags and modifies the tag. It does not care if the image is on another domain or not.

Best, Sammi

       
ErwinVanLun's avatar
ErwinVanLun
235 posts
17 years ago
ErwinVanLun's avatar ErwinVanLun

ok, look forward to a solution!

btw: i’ve nominated www.scienceofthetime.com for EE site gallery/interview. I’ve mentioned the use of your plugin here!

       
sambo's avatar
sambo
80 posts
17 years ago
sambo's avatar sambo

Hi,

Thank you for mentioning my little plugin 😉

I was looking at what might be causing this division by zero problem and found the bug causing it. I have fixed it and you can download the updated plugin from the site.

The problem did not have anything to do with the images being from an external domain. The problem occurred in the calculation routine that automatically figured out image height or with if only one of the two was given.

If you want to create thumbnails of images on a remote server I think you have to fiddle with this part of the phpThumb config (not sure though if that is enough):

// * Off-server Thumbnailing Configuration:
$PHPTHUMB_CONFIG['nohotlink_enabled']           = false;                                    // If false will allow thumbnailing from any source domain
$PHPTHUMB_CONFIG['nohotlink_valid_domains']     = array(@$_SERVER['HTTP_HOST']);            // This is the list of domains for which thumbnails are allowed to be created. Note: domain only, do not include port numbers. The default value of the current domain should be fine in most cases, but if neccesary you can add more domains in here, in the format "www.example.com"
$PHPTHUMB_CONFIG['nohotlink_erase_image']       = true;                                     // if true thumbnail is covered up with $PHPTHUMB_CONFIG['nohotlink_fill_color'] before text is applied, if false text is written over top of thumbnail
$PHPTHUMB_CONFIG['nohotlink_text_message']      = 'Off-server thumbnailing is not allowed'; // text of error message

Best, Sami

       
kjdekoning's avatar
kjdekoning
19 posts
17 years ago
kjdekoning's avatar kjdekoning

What a great plugin! Almost everything works as expected, but i only can’t get “align” to work. Whatever i try it’s not aligning. Am i doing something wrong or is there an error in the plugin. This is my code:

{exp:shj_imgmodifier phpthumb="true" phpthumb_path="../phptumb/phpThumb.php" phpthumb_attributes="q=50&zc=1" clear="true" align="right" width="100" height="100"}

{body}

{/exp:shj_imgmodifier}

Thanks in advance!

UPDATE: That was easy: Add under line 156 $attributeList[“align”] = $this->ppAlign;

       
sambo's avatar
sambo
80 posts
17 years ago
sambo's avatar sambo

Hi,

thank you for pointing out this error. I have updated the plugin with your correction.

Best, Sammi

       
pushloop's avatar
pushloop
422 posts
about 17 years ago
pushloop's avatar pushloop

Hey Sambo

I’m having problems getting the plugin to work. I’m getting an error when using the exact same code as I’m using on another project, which is working fine.

Template:

{exp:shj_imgmodifier phpthumb="true" phpthumb_path="/images/thumb/phpThumb.php" phpthumb_attributes="q=50&zc=1" width="40" height="40" lightbox="true"}
 {nyheter_bild}
{/exp:shj_imgmodifier}

Error: “Fatal error: Call to undefined function: array_combine() in /home/evntyr/www.eventyr.se/eventsinside/plugins/pi.shj_imgmodifier.php on line 98”

Using the latest version of the plugin, downloaded today.

Tnx/Takk

       
sambo's avatar
sambo
80 posts
16 years ago
sambo's avatar sambo

Hi,

I find it very strange that you are getting this error because in the latest code there is no array_combine method. I had to create a new method called array_combine_php4 because array_combine was not available in PHP4.

I bet your other site is running on a PHP 5 server - and therefor working.

Please try to download the latest source code again and verify that lines 100 and 185 are using array_combine_php4.

Best, Sambo

       
1 2 3

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.