MyBB Community Forums

Full Version: Collapse .gif to .png?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Okay, so I searched around and found a solution to do this, which was editing the general.js file.
http://community.mybb.com/thread-123693-page-2.html

I copied over the modified .js file to my theme's directory.
images/mytheme/jscripts/general.js

Removed the old <script> line from the header include and added.
<script type="text/javascript" src="{$mybb->settings['bburl']}/images/impress/jscripts/general.js?ver=1603"></script>

The general.js can load from the browser when visited directly.

Now all my forum shows is [+] and [-], I click view image and it's .gif instead of .png
Any ideas? here is the general.js file.

http://pastie.org/pastes/5796987/text
Find

if(element.src.match("off.gif") || element.src.match("offlock.gif")

Change it to

if(element.src.match("off.png") || element.src.match("offlock.png")


Find

$('mark_read_'+fid).src = $('mark_read_'+fid).src.replace("on.gif", "off.gif");

Change it to

$('mark_read_'+fid).src = $('mark_read_'+fid).src.replace("on.png", "off.png");


I'm not 100% sure if this works or not but I can give a better solution and hopefully working one if you can provide me your sites URL in this thread or via PM.
(2013-01-21, 10:49 PM)Turbo Wrote: [ -> ]Okay, so I searched around and found a solution to do this, which was editing the general.js file.
http://community.mybb.com/thread-123693-page-2.html

I copied over the modified .js file to my theme's directory.
images/mytheme/jscripts/general.js

Removed the old <script> line from the header include and added.
<script type="text/javascript" src="{$mybb->settings['bburl']}/images/impress/jscripts/general.js?ver=1603"></script>

The general.js can load from the browser when visited directly.

Now all my forum shows is [+] and [-], I click view image and it's .gif instead of .png
Any ideas? here is the general.js file.

http://pastie.org/pastes/5796987/text

I've had the same problems when trying to convert other images from .gif to .png,and can only assume that there are a lot more files than just the general.js file that need editing for the .png's to display.
(2013-01-21, 11:02 PM)kamz89 Wrote: [ -> ]Find

if(element.src.match("off.gif") || element.src.match("offlock.gif")

Change it to

if(element.src.match("off.png") || element.src.match("offlock.png")


Find

$('mark_read_'+fid).src = $('mark_read_'+fid).src.replace("on.gif", "off.gif");

Change it to

$('mark_read_'+fid).src = $('mark_read_'+fid).src.replace("on.png", "off.png");


I'm not 100% sure if this works or not but I can give a better solution and hopefully working one if you can provide me your sites URL in this thread or via PM.

Just looking to do it for the collapse images, not the off and on ones yet.
My bad. Well can you PM me your site or an easy solution. Rename your collapse images to .png from .gif in your FTP.

Edited

Find

element.src = element.src.replace("collapse_collapsed.png", "collapse.png");				

Change it to
element.src = element.src.replace("collapse_collapsed.EXTENSION", "collapse.EXTENSION");	

Find

element.src = element.src.replace("collapse.png", "collapse_collapsed.png");

Change it to

element.src = element.src.replace("collapse.EXTENSION", "collapse_collapsed.EXTENTSION");

Change EXTENSION to the files extension it should be
I modified the .js to .png, originally it said .gif. But it's still pulling .gif.
(2013-01-21, 11:23 PM)Turbo Wrote: [ -> ]I modified the .js to .png, originally it said .gif. But it's still pulling .gif.

Now, not the jscript file. You should change the extension of the image if you want to rename it which will be in the images directory. I don't know what's wrong with me today for not giving full explanations or reading the whole post lol.
I already have the .png images in the directory. On the forum itself, the image appears broken. I click on "View Image" on firefox and it's still pulling collapse.gif instead of .png.
Try this.

Find

element.src = element.src.replace("collapse_collapsed.png", "collapse.png");				

Change it to
element.src = element.src.replace("collapse_collapsed.gif", "collapse.gif");	

Find

element.src = element.src.replace("collapse.png", "collapse_collapsed.png");

Change it to

element.src = element.src.replace("collapse.gif", "collapse_collapsed.gif");
That would restore it back to original, I'm trying for it to display my custom .png collapse image.
Pages: 1 2