2 of 3
2
New plugin : IMG Tag Modifier - to modify inline image tags
Posted: 01 May 2008 02:57 AM   [ Ignore ]   [ # 19 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  231
Joined  07-09-2006

Hi Sambo,

Sorry to keep you bothering surprised . 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)<br>
"image" tag<br>
<
xmp>{image}</xmp><br>
<
br>

With paragraph marks:<br>
<
p>{image}</p><br><br>


Calling phpThumb with <br>
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)<br>
<img src="/thumb/phpThumb.php?src=http://www.signsofthetime.eu/images/top15/R4-bling2.jpg&w=100"><br><br>
<br>
So phpThumb seems to work fine <br><br>

Now calling exp:Shj_imgmodifier on "image" tag (leaving away parsing symbols)<br>
exp:Shj_imgmodifier phpthumb="true" phpthumb_path="/thumb/phpThumb.php" phpthumb_attributes="q=50&zc=1" width="100" height="100" lightbox="false"<br>
image<br>
/exp:Shj_imgmodifier<br><br>

Result:<br>
<p>{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}</p>

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

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

  {/exp:weblog:entries}

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

Erwin

 Signature 

Erwin van Lun
Marketeer on a Mission

Profile
 
 
Posted: 01 May 2008 03:34 AM   [ Ignore ]   [ # 20 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  231
Joined  07-09-2006

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

 Signature 

Erwin van Lun
Marketeer on a Mission

Profile
 
 
Posted: 01 May 2008 03:54 AM   [ Ignore ]   [ # 21 ]  
Grad Student
Rank
Total Posts:  64
Joined  09-12-2005

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">
{/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

 Signature 

Samuel Jonasson / trikk.is

Profile
 
 
Posted: 01 May 2008 05:23 AM   [ Ignore ]   [ # 22 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  231
Joined  07-09-2006

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!

 Signature 

Erwin van Lun
Marketeer on a Mission

Profile
 
 
Posted: 01 May 2008 06:23 AM   [ Ignore ]   [ # 23 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  347
Joined  04-23-2008
Erwin van Lun - 01 May 2008 05:23 AM

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.

 Signature 

Danny, your poor-man’s EE designer for hire/help.

Profile
 
 
Posted: 01 May 2008 06:56 AM   [ Ignore ]   [ # 24 ]  
Grad Student
Rank
Total Posts:  64
Joined  09-12-2005
Erwin van Lun - 01 May 2008 05:23 AM

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 wink
- 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 wink

Best,
Sambo

 Signature 

Samuel Jonasson / trikk.is

Profile
 
 
Posted: 04 May 2008 05:04 AM   [ Ignore ]   [ # 25 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  231
Joined  07-09-2006

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 {filedir_1} is ignored. I tried to solve this with:

Image:<br>
{exp:ee_typography}{ image}{/exp:ee_typography}<br><br>

Modified image:<br>
{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 {filedir_1} by hard coded URL’s. That will help, but is not handy.

 Signature 

Erwin van Lun
Marketeer on a Mission

Profile
 
 
Posted: 04 May 2008 12:01 PM   [ Ignore ]   [ # 26 ]  
Grad Student
Rank
Total Posts:  64
Joined  09-12-2005

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

 Signature 

Samuel Jonasson / trikk.is

Profile
 
 
Posted: 04 May 2008 02:43 PM   [ Ignore ]   [ # 27 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  231
Joined  07-09-2006

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:<br>
<
xmp>{image}</xmp><br><br>

Image:<br>
{exp:ee_typography}{ image}{/exp:ee_typography}<br><br>

Modified image:<br>
{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/

 Signature 

Erwin van Lun
Marketeer on a Mission

Profile
 
 
Posted: 04 May 2008 03:14 PM   [ Ignore ]   [ # 28 ]  
Grad Student
Rank
Total Posts:  64
Joined  09-12-2005

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?

 Signature 

Samuel Jonasson / trikk.is

Profile
 
 
Posted: 04 May 2008 03:31 PM   [ Ignore ]   [ # 29 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  231
Joined  07-09-2006

Hi Sambo,
The paths are correct, but the problem is that—within a SQL statement—the {filedir_1}tag isn’t parsed at all.

Code with xmp:<br>
<
xmp>{image}</xmp><br><br>

Image:<br>
{exp:ee_typography}{ image}{/exp:ee_typography}<br><br>

Modified image:<br>
{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.

 Signature 

Erwin van Lun
Marketeer on a Mission

Profile
 
 
Posted: 04 May 2008 03:43 PM   [ Ignore ]   [ # 30 ]  
Grad Student
Rank
Total Posts:  64
Joined  09-12-2005

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

 Signature 

Samuel Jonasson / trikk.is

Profile
 
 
Posted: 04 May 2008 03:51 PM   [ Ignore ]   [ # 31 ]  
Grad Student
Rank
Total Posts:  64
Joined  09-12-2005

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"}
<img src="{image}" width="100" height="100"/>
{/exp:Shj_imgmodifier}

 Signature 

Samuel Jonasson / trikk.is

Profile
 
 
Posted: 04 May 2008 03:52 PM   [ Ignore ]   [ # 32 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  231
Joined  07-09-2006

Optimised the test page:

[code}Just Image:<br>
{image}<br><br>

XMP code :<br>
<xmp>{image}</xmp><br><br>

XMP code with ee_typography:<br>
<xmp>{exp:ee_typography allow_image_urls=“y”}{ image}{/exp:ee_typography}</xmp><br><br>

{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:<br>
{exp:ee_typography allow_image_urls=“y”}{ image}{/exp:ee_typography}<br><br>
Modified image without ee_typography:<br>
{image}<br><br>
{/exp:shj_imgmodifier}
<br><br>
{/exp:query}

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…

 Signature 

Erwin van Lun
Marketeer on a Mission

Profile
 
 
Posted: 04 May 2008 04:07 PM   [ Ignore ]   [ # 33 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  231
Joined  07-09-2006

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://expressionengine.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

 Signature 

Erwin van Lun
Marketeer on a Mission

Profile
 
 
Posted: 04 May 2008 04:10 PM   [ Ignore ]   [ # 34 ]  
Grad Student
Rank
Total Posts:  64
Joined  09-12-2005

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

Good luck with your deadline.

 Signature 

Samuel Jonasson / trikk.is

Profile
 
 
Posted: 30 June 2008 06:45 AM   [ Ignore ]   [ # 35 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  231
Joined  07-09-2006

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

 Signature 

Erwin van Lun
Marketeer on a Mission

Profile
 
 
Posted: 30 June 2008 07:55 AM   [ Ignore ]   [ # 36 ]  
Grad Student
Rank
Total Posts:  64
Joined  09-12-2005

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

 Signature 

Samuel Jonasson / trikk.is

Profile
 
 
   
2 of 3
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65096 Total Logged-in Users: 56
Total Topics: 82243 Total Anonymous Users: 38
Total Replies: 442010 Total Guests: 289
Total Posts: 524253    
Members ( View Memberlist )