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

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

Thanks Sambo, this seems exactly what I was I looking for. As I have lots of posts with lots of images of different sizes, which should never exceed the width of 400 pixels.

However, I can’t get it work. It get numbers like M40o93H7pQ09L8X1t49cHY01Z5j4TT91fGfr on the location where the new images should be. Here’s the code:

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}

/thumb/phpThumb.php?src=http://www.signsofthetime.eu/images/content/collageMT.jpg&w=100

The last part shows me that phpThumb works properly. But now the Shj_imgmodifier part…. Erwin

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

Hi,

So the HTML is as expected but the images get funny names in the filesystem?

I think must be some phpThumb config.

Best, Sambo

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

Thanks Sambo, Your suggestion brought me to the following experiment:

<xmp>{image}</xmp>
"/thumb/phpThumb.php?src={image}

Here is the result: PHP thumb error: phpThumb () v.1.7.9-200804102107 “/home/signsoothetime.eu/public_html/thumb/<img

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

Hi,

You can not put an img tag in the source parameter of phpthumb. Just use the path to the image.

My plugin does that automatically - that is - it picks the src parameter from the img tag and uses that for phpthumb.

Do you have a url where I can see the html that the plugin creates and the error?

Sambo

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

Hi Sambo,

Sorry to keep you bothering :wow: . Your Plugin seems to be THE solution to my problem. As I also have a deadline for this site, next week monday, I’m currently working day and night.

So I have made a test page: http://www.signsofthetime.eu/test

with this code:

{exp:weblog:entries weblog="cool|cooltop15|news" limit="1" disable="trackbacks" entry_id="132" dynamic="off"}

   <div class="post">

Raw Image tag (formatted: None)

"image" tag

<xmp>{image}</xmp>




With paragraph marks:

{image}




Calling phpThumb with 

img src="/thumb/phpThumb.php?src=http://www.signsofthetime.eu/images/top15/R4-bling2.jpg&w=100" (with brackets of course, but can't type them here, they will be parsed)

/thumb/phpThumb.php?src=http://www.signsofthetime.eu/images/top15/R4-bling2.jpg&w=100




So phpThumb seems to work fine 



Now calling exp:Shj_imgmodifier on "image" tag (leaving away parsing symbols)

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



Result:

{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}

Now calling exp:Shj_imgmodifier on a XHML formatted piece of text which includes multiplie images:



{exp:Shj_imgmodifier phpthumb="true" phpthumb_path="thumb/phpThumb.php" phpthumb_attributes="q=50&zc=1" width="100" height="100"}
{why_its_cool}
{/exp:Shj_imgmodifier}


  {/exp:weblog:entries}

To demonstrate when the strange numbers come up. Really no clue what’s going on….

Erwin

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

Hi Sambo, Our replies crossed. Hope previous posts clearifies my problem. Erwin

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

Hi,

this is very strange because the following code works on my site:

{exp:shj_imgmodifier phpthumb="true" phpthumb_path="/thumb/phpThumb.php" phpthumb_attributes="q=50&zc=1" width="100" height="100" lightbox="false"}
<img src="http://www.signsofthetime.eu/images/top15/R4-bling2.jpg" alt=""  />
{/exp:shj_imgmodifier}

I did notice that I was relying on PHP5 for one function in the plugin and now I have updated that.

Go and check if the updated plugin works any better.

Also make sure that exp:shj_imgmodifier is all lowercase. I think that matters.

Best, Sambo

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

Hi Sambo,

That was it! I was just the use of the capital :-(. It now works fine. Great actually!

I have also two other websites (www.mensmerk.nl and www.erwinvanlun.com) and I have been looking for a scheduled ‘nifty corners’ function for a long time. I will use this plugin for these sites as well. On top, I will also use LightBox. This will have great results. (but I do this later as I have to figure out how Lightbox works).

For now, I would like to give you three suggestions: 1)In your posting on this thread, posted: 02 March 2008 12:12 PM, you use the capital S. I just copied you code assuming it was okay. You might consider correcting this. 2) Why don’t you rename your plugin to img_modified? That’s more consistent with other plugins and EE standards. 3) Smileys in the code are also resized. Although it looks very funny, this is certainly not your intention. How could we tackle this one? Read the path for smileys and ignore smileys?

Lots of success with your plugin and thanks for your fast reactions!

       
Danny T.'s avatar
Danny T.
426 posts
17 years ago
Danny T.'s avatar Danny T.
3) Smileys in the code are also resized. Although it looks very funny, this is certainly not your intention. How could we tackle this one? Read the path for smileys and ignore smileys?

Haven’t used it..

Great suggestion, or we could define a certain size of image to not quality via it’s relative size. Smiley’s are small, so anything greater in height=”30” and width=”30” probably won’t need it. I can’t imagine any smiley’s being larger than that.

       
sambo's avatar
sambo
80 posts
17 years ago
sambo's avatar sambo
For now, I would like to give you three suggestions: 1)In your posting on this thread, posted: 02 March 2008 12:12 PM, you use the capital S. I just copied you code assuming it was okay. You might consider correcting this. 2) Why don’t you rename your plugin to img_modified? That’s more consistent with other plugins and EE standards. 3) Smileys in the code are also resized. Although it looks very funny, this is certainly not your intention. How could we tackle this one? Read the path for smileys and ignore smileys?

Hi,

  • Yes I noticed that I used capital S in the post and also in the documentation on the website. Sorry about that - I have fixed it now.
  • I thought it might be a good idea to prefix my plugins with my initials to prevent conflicts. Maybe it just causes problems 😉
  • I can think of several ways to solve the smiley problem but unfortunately I do not have time to implement them now. I hope I will be able to do it soon.

Good luck with your sites 😉

Best, Sambo

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

Hi Sambo,

Going on with your awesome plugin, I have found the following challenge:

http://www.signsofthetime.eu/sandbox/image_lcoal_test

In this case, the {image} tag does not come from a exp:weblog clause but from a exp:sql clause. Same statement, but then https://ellislab.com/asset/images/team-photo/ is ignored. I tried to solve this with:

Image:

{exp:ee_typography}{ image}{/exp:ee_typography}



Modified image:

{exp:shj_imgmodifier phpthumb="true" phpthumb_path="/thumb/phpThumb.php" phpthumb_attributes="q=50&zc=1" width="420" lightbox="false" clear="true"}
<div class="post">
{exp:ee_typography}{image}{/exp:ee_typography}
</div>
{/exp:shj_imgmodifier}

But this gives, unfortunately, again the ‘funny numbers’.

You plugin should actually be able to parse {filedir_x} statements.

For now, I can’t find a solution for this problem (or just by replacing all https://ellislab.com/asset/images/team-photo/ by hard coded URL’s. That will help, but is not handy.

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

Hi,

Have you tried to add the parse=”inward” parameter to the plugin?

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

I think that might do the trick.

Sambo

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

HI Sambo,

Actually I didn’t try it (because I didn’t know it existed). In the plugin and on your website the parameter is not mentioned. I have found version 0.1 of your plugin. I’m not at all a php guru, but the parameter ‘parse’ isn’t in the ‘fetch’ list.

This is the code:

Code with xmp:

<xmp>{image}</xmp>



Image:

{exp:ee_typography}{ image}{/exp:ee_typography}



Modified image:

{exp:shj_imgmodifier phpthumb="true" phpthumb_path="/thumb/phpThumb.php" phpthumb_attributes="q=50&zc=1" width="420" lightbox="false" clear="true" parse="inward"}
<div class="post">
{image}
</div>
{/exp:shj_imgmodifier}

but still the same results on http://www.signsofthetime.eu/sandbox/image_lcoal_test/

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

Hi,

yes the parse parameter isn’t in my plugin. I think it is something that all plugins inherit from the system. It is a documented EE feature and changes the order of the parsing.

But the errors I see on your test page indicate that the plugin is working, but the image path isn’t correct. PhpThumb says the image can not be found. Have you verified that paths?

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

Hi Sambo, The paths are correct, but the problem is that – within a SQL statement – the https://ellislab.com/asset/images/team-photo/tag isn’t parsed at all.

Code with xmp:

<xmp>{image}</xmp>



Image:

{exp:ee_typography}{ image}{/exp:ee_typography}



Modified image:

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

And still the funny numbers…. :-(

I have also tried this without the typography tag, it then says the picture can’t be found.

       
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.